2012-08-06から1日間の記事一覧

Codeforces 214A - A. System of Equations

214A - A. System of Equations全探索。 calc n m = sum [1 | a<-[0..1000], b<-[0..1000], a^2+b==n, a+b^2==m] main = do s <- getLine let xs = map (\x -> read x :: Int) $ words s let (n, m) = (xs!!0, xs!!1) putStrLn $ show $ calc n m

Codeforces 200B - Drinks

200B - Drinks calc xs = (sum xs / fromIntegral (100 * length xs)) * 100 main = do s <- getLine t <- getLine putStrLn $ show $ calc $ map (\x -> read x :: Double) $ words t 型に関する理解があいまいなので、型エラーがなかなか取れませんでした…

Codeforces 199A - A. Hexadecimal's theorem

199A - A. Hexadecimal's theoremフィボナッチ数列を求める関数を作成しましたが、必要ありませんでした。 main = do s <- getLine putStrLn ("0 0 " ++ s)

Codeforcesの問題をHaskellで解いてみる

Haskellで問題を解いてみます。CodeforcesのRatingは1300くらいなので、div2の易しい問題を中心に解いていきたいと思います。