Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Data.List
- import Data.Char
- import Data.Maybe
- a = [1..10000]
- cubes = [show (y^3) | y<-a]
- contains x y z = if length(x) /= length(y) && z == 0 then False
- else if z == length(x) then True
- else if (x!!z) `elem` y then contains x (removeElement x y z) (z+1)
- else False
- removeElement x y z = (take (fromJust(elemIndex (x!!(z)) y)) y)++(drop (1+fromJust(elemIndex (x!!(z)) y)) y)
- checkIt x = [y | y<-cubes, contains x y 0]
- test x = if length(checkIt (x)) == 5 then True
- else False
- finally :: Int
- finally = read (minimum [y | y<-cubes , test y])
- main = do
- print(finally)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement