Login
Immutable PageDiscussionInfoAttachments
iz/競技プログラミング/Project Euler 029 Distinct powers

MMA

http://projecteuler.net/problem=29

全列挙するだけ

   1 #!/usr/bin/env ruby
   2 
   3 a = (2..100).collect do |a|
   4   (2..100).collect do |b|
   5     a ** b
   6   end
   7 end
   8 
   9 p a.flatten.sort.uniq.size

iz/競技プログラミング/Project Euler 029 Distinct powers (last edited 2012-12-22 11:30:42 by iz)