結果

問題 No.415 ぴょん
ユーザー momen999momen999
提出日時 2017-04-21 08:33:20
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 571 bytes
コンパイル時間 7,452 ms
コンパイル使用メモリ 162,932 KB
実行使用メモリ 7,184 KB
最終ジャッジ日時 2023-09-27 10:38:26
合計ジャッジ時間 4,583 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,948 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 WA -
testcase_03 AC 2 ms
7,056 KB
testcase_04 AC 3 ms
7,088 KB
testcase_05 AC 2 ms
7,140 KB
testcase_06 AC 2 ms
7,084 KB
testcase_07 AC 3 ms
7,020 KB
testcase_08 AC 3 ms
7,128 KB
testcase_09 AC 3 ms
7,076 KB
testcase_10 AC 3 ms
7,120 KB
testcase_11 AC 3 ms
7,060 KB
testcase_12 AC 3 ms
7,012 KB
testcase_13 AC 2 ms
7,068 KB
testcase_14 AC 2 ms
7,112 KB
testcase_15 AC 3 ms
7,116 KB
testcase_16 AC 3 ms
7,100 KB
testcase_17 AC 3 ms
7,172 KB
testcase_18 AC 3 ms
7,116 KB
testcase_19 AC 3 ms
7,076 KB
testcase_20 AC 3 ms
7,000 KB
testcase_21 AC 3 ms
7,020 KB
testcase_22 WA -
testcase_23 AC 3 ms
7,180 KB
testcase_24 AC 2 ms
7,104 KB
testcase_25 AC 2 ms
7,088 KB
testcase_26 AC 2 ms
7,184 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Monad
--import Debug.Trace

saidaikouyakusuu a b r
    | r == 0        = b
    | otherwise     = saidaikouyakusuu b r (b `mod` r)

pyon :: (Integral a) => a -> a -> a
pyon n k
    | (n - k == 0) || (k == 1)  = n - 1
    | r == 1                    = n - 1
    | otherwise                 = n' - 1
    where
        r = saidaikouyakusuu n k (n `mod` k)
        n' = div n r

main = do
    nk <- map (read :: String -> Int) . words <$> getLine
    let
        hasira = [0] ++ take (n - 1) [1,1..]
        n = head nk
        k = last nk
    print $ pyon n k
0