結果

問題 No.376 立方体のN等分 (2)
ユーザー pekempeypekempey
提出日時 2016-07-29 03:17:48
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 630 bytes
コンパイル時間 1,347 ms
コンパイル使用メモリ 171,392 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2024-04-24 10:41:28
合計ジャッジ時間 17,523 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 359 ms
7,936 KB
testcase_18 WA -
testcase_19 AC 375 ms
8,064 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 396 ms
8,192 KB
testcase_23 WA -
testcase_24 AC 961 ms
9,728 KB
testcase_25 AC 423 ms
8,192 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 429 ms
8,192 KB
testcase_29 WA -
testcase_30 AC 428 ms
8,064 KB
testcase_31 AC 424 ms
8,192 KB
testcase_32 AC 413 ms
8,064 KB
testcase_33 AC 421 ms
8,064 KB
testcase_34 AC 422 ms
8,064 KB
testcase_35 WA -
testcase_36 AC 423 ms
8,192 KB
testcase_37 AC 424 ms
8,192 KB
testcase_38 WA -
testcase_39 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

divisors n = f n 1
    where
        f n i
            | i * i > n      = []
            | n `rem` i == 0 = i : (f n (i + 1))
            | otherwise      = f n (i + 1)

divisors2 n ds = map (\x -> [x, n `quot` x]) . takeWhile (\x -> x ^ 2 <= n) $ ds
divisors3 n = concat . map (\x -> map (x : ) (divisors2 (n `quot` x) ds)) . takeWhile (\x -> x ^ 3 <= n) $ ds
    where
        ds = divisors n

evaluate (p : q : r : []) = (p - 1) + (q - 1) + (r - 1)

solveMin = minimum . map evaluate . divisors3
solveMax = (+ (-1))

main = do
    n <- readLn :: IO Integer
    putStrLn $ (show . solveMin) n ++ " " ++ (show . solveMax) n
    
0