# -*- coding: undecided -*- # http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2056 # # そのまま.. puts (1 ... 100).reduce(0) {|max, a| (1 ... 100).reduce(0) {|max, b| [max, (a ** b).to_s.chars.map(&:to_i).reduce(:+)].max } }