C/C++の宿題をやって。おながい。14代目

このエントリーをはてなブックマークに追加
>>733
list = [ x * x | x <- [min..max], iSort (show (x * x)) == "0123456789" ]
 where
 min = toInteger(truncate (sqrt (fromInteger 1023456789)))
 max = toInteger(floor (sqrt (fromInteger 9876543210)))
 iSort xs = foldr ins [] xs
  where
  ins x [] = [x]
  ins x (y:ys)
   | x <= y = x : (y:ys)
   | otherwise = y : ins x ys

Main> list
[1026753849, (中略), 9814072356]
Main> length list
87