problem 33

いまいち美しくない。

Prelude List> let f a b c d = ((a==c && (a*10+b)/(c*10+d)==b/d)||(a==d&&(a*10+b)/(c*10+d)==b/c)||(b==c&&(a*10+b)/(c*10+d)==a/d)||(b==d&&(a*10+b)/(c*10+d)==a/c))&&(b/=0&&d/=0)&&(a/=c&&b/=d) in  map product $ transpose [[x,y]|x<-[10..99],y<-[10..99], div x y<1,f (read [(show x)!!0]) (read [(show x)!!1]) (read [(show y)!!0]) (read [(show y)!!1])]
[387296,38729600]
it :: [Integer]
(0.20 secs, 124395232 bytes)