Project Eueler: problem13

問題

Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.

37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
.....

回答

ar = []
DATA.each do |line|
  ar << line.chomp!.to_i
end
p ar.inject(0){|sum,i| sum + i}.to_s[0,10]
__END__
37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
.....