CSES - Datatähti 2018 alku - Results
Submission details
Task:Bittijono
Sender:Shrike
Submission time:2017-10-10 11:28:54 +0300
Language:Haskell
Status:COMPILE ERROR

Compiler report

input/code.hs:32:9:
    No instance for (Show (Integer -> [Char]))
      arising from a use of `print'
    Possible fix:
      add an instance declaration for (Show (Integer -> [Char]))
    In a stmt of a 'do' block: print (theString (read (n) :: Integer))
    In the expression:
      do { n <- getLine;
           print (theString (read (n) :: Integer)) }
    In an equation for `main':
        main
          = do { n <- getLine;
                 print (theString (read (n) :: Integer)) }

Code

nth :: Integer -> Integer
nth 0 = 0
nth 1 = 1
nth n  = sum [minimum [2^k, n-k+1] | k <- [0..n+1]]

findLen :: Integer -> Integer -> Integer
findLen 0 _ = 0
findLen 1 _ = 1
findLen 2 _ = 2
findLen 3 _ = 2
findLen 4 _ = 3
findLen n k = n*k

theString :: Integer -> Integer -> [Char]
theString 0  _ = ""
theString 1  _ = "1"
theString 2  _ = "11"
theString 3  _ = "10"
theString 4  _ = "110"
theString 5  _ = "101"
theString 6  _ = "101"
theString 7  _ = "1011"
theString 8  _ = ""
theString 9  _ = ""
theString 10 _ = ""
		 


main = do
	n <- getLine
	print (theString (read(n) :: Integer))