09/08/03 20:56:19
>>602
-- Haskell で.総当たり
import Data.List (permutations)
t602 = [xs | xs@[e,f,g,h,i,n,o,t,w,y] <- permutations [0..9],
o /= 0, n /= 0, t /= 0, f /= 0, e /= 0,
a [o,n,e] + a [n,i,n,e] + a [t,w,e,n,t,y] + a [f,i,f,t,y] == a [e,i,g,h,t,y]]
where
a xs = foldl (\s i -> 10*s + i) 0 xs
main = print $ head $ t602