Skip to content

Instantly share code, notes, and snippets.

@masahixixi
Created November 5, 2012 07:40
Show Gist options
  • Save masahixixi/4015820 to your computer and use it in GitHub Desktop.
Save masahixixi/4015820 to your computer and use it in GitHub Desktop.
ProjectEuler #13
number_ary = []
number_list = open("./problem13_num")
ans = 0
while number_data = number_list.gets
number_ary << number_data.chomp
end
(0..99).each do |num|
ans += number_ary[num].to_i
end
p ans.to_s[0..9]
number_ary = []
number_list = open("./problem13_num")
ans = 0
while number_data = number_list.gets
number_ary << number_data.chomp
end
(0..number_ary.length - 1).each do |num|
ans += number_ary[num].to_i
end
p ans.to_s[0..9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment