[2020][ruby][25]

pull/2/head
Alpha Chen 4 years ago
parent 1a30bb23a1
commit bb763d6644

@ -0,0 +1,17 @@
def transform(subject_number)
return enum_for(__method__, subject_number) unless block_given?
value = 1
(0..).each do |loop_size|
yield [loop_size, value]
value *= subject_number
value %= 20201227
end
end
public_keys = ARGF.read.scan(/\d+/).map(&:to_i)
loop_size, _ = transform(7).find {|_,v| v == public_keys.first }
_, encryption_key = transform(public_keys.last).find {|i,_| i == loop_size }
p encryption_key
Loading…
Cancel
Save