Created
July 27, 2019 14:51
-
-
Save manojnaidu619/134a1eedd00c9ebc461656e5776e1889 to your computer and use it in GitHub Desktop.
Codechef solution for " Easy Math (prob code : RPD) " in Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = gets.to_i | |
count = [] | |
a = [] | |
n.times do | |
count << gets.to_i | |
s = gets.strip.split(/\s+/).map(&:to_i) | |
a << s | |
#p sum.max | |
end | |
a.each do |i| | |
sum = [] | |
for x in 0..i.count do | |
for y in x+1...i.count do | |
sum << (i[x]*i[y]).to_s.split('').map{|e| e.to_i}.reduce(:+) | |
end | |
end | |
p sum.max | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment