結果

問題 No.152 貯金箱の消失
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-01-01 22:04:08
言語 Haskell
(9.6.2)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 308 bytes
コンパイル時間 3,701 ms
コンパイル使用メモリ 183,516 KB
実行使用メモリ 9,508 KB
最終ジャッジ日時 2023-10-19 13:04:11
合計ジャッジ時間 5,690 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,380 KB
testcase_01 AC 3 ms
5,456 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 3 ms
5,440 KB
testcase_04 AC 4 ms
6,432 KB
testcase_05 AC 5 ms
6,528 KB
testcase_06 AC 6 ms
7,392 KB
testcase_07 AC 33 ms
9,488 KB
testcase_08 AC 123 ms
9,508 KB
testcase_09 AC 132 ms
9,508 KB
testcase_10 AC 103 ms
9,508 KB
testcase_11 AC 63 ms
9,508 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

getCombinations :: Integral a => a -> Int
getCombinations l0 = length cs where
    l1 = div l0 4
    l2 = ceiling $ sqrt $ fromIntegral l1
    cs = [(m, n) | m <- [1 .. l2], n <- [1 .. m - 1],
        gcd m n == 1, odd $ m - n, 2 * m * (m + n) <= l1]

main :: IO ()
main = print . getCombinations =<< readLn
0