結果

問題 No.747 循環小数N桁目 Hard
ユーザー HaarHaar
提出日時 2018-11-11 22:02:31
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 514 bytes
コンパイル時間 7,433 ms
コンパイル使用メモリ 167,676 KB
実行使用メモリ 15,860 KB
最終ジャッジ日時 2023-08-21 12:51:42
合計ジャッジ時間 13,326 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,648 KB
testcase_01 AC 3 ms
6,692 KB
testcase_02 AC 3 ms
6,700 KB
testcase_03 AC 3 ms
6,668 KB
testcase_04 AC 2 ms
6,596 KB
testcase_05 AC 3 ms
6,576 KB
testcase_06 AC 2 ms
6,644 KB
testcase_07 AC 2 ms
6,644 KB
testcase_08 AC 3 ms
6,656 KB
testcase_09 WA -
testcase_10 AC 2 ms
6,608 KB
testcase_11 AC 3 ms
6,680 KB
testcase_12 AC 2 ms
6,604 KB
testcase_13 AC 2 ms
6,652 KB
testcase_14 WA -
testcase_15 AC 3 ms
6,608 KB
testcase_16 AC 2 ms
6,580 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
6,592 KB
testcase_20 AC 2 ms
6,632 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
6,636 KB
testcase_24 AC 3 ms
6,588 KB
testcase_25 WA -
testcase_26 AC 2 ms
6,620 KB
testcase_27 AC 3 ms
6,664 KB
testcase_28 AC 2 ms
6,644 KB
testcase_29 AC 2 ms
6,668 KB
testcase_30 AC 2 ms
6,648 KB
testcase_31 AC 2 ms
6,584 KB
testcase_32 AC 3 ms
6,656 KB
testcase_33 AC 12 ms
11,824 KB
testcase_34 AC 5 ms
9,216 KB
testcase_35 AC 3 ms
8,044 KB
testcase_36 AC 6 ms
10,672 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 12 ms
12,300 KB
testcase_41 AC 12 ms
12,460 KB
testcase_42 AC 12 ms
11,880 KB
testcase_43 AC 5 ms
10,304 KB
testcase_44 AC 12 ms
11,440 KB
testcase_45 AC 12 ms
11,616 KB
testcase_46 AC 8 ms
11,464 KB
testcase_47 AC 12 ms
11,768 KB
testcase_48 AC 6 ms
10,560 KB
testcase_49 AC 12 ms
11,288 KB
testcase_50 AC 5 ms
10,016 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 AC 23 ms
15,340 KB
testcase_54 AC 23 ms
13,800 KB
testcase_55 AC 22 ms
14,240 KB
testcase_56 WA -
testcase_57 AC 5 ms
9,880 KB
testcase_58 AC 22 ms
15,860 KB
testcase_59 AC 12 ms
11,456 KB
testcase_60 AC 22 ms
14,612 KB
testcase_61 AC 12 ms
12,268 KB
testcase_62 AC 12 ms
12,688 KB
testcase_63 AC 12 ms
12,160 KB
testcase_64 WA -
testcase_65 AC 3 ms
7,524 KB
testcase_66 AC 12 ms
11,248 KB
testcase_67 AC 7 ms
10,928 KB
testcase_68 WA -
testcase_69 AC 12 ms
11,840 KB
testcase_70 AC 5 ms
9,496 KB
testcase_71 AC 5 ms
9,200 KB
testcase_72 AC 6 ms
10,752 KB
testcase_73 AC 9 ms
11,692 KB
testcase_74 AC 12 ms
11,576 KB
testcase_75 AC 6 ms
10,088 KB
testcase_76 AC 8 ms
11,008 KB
testcase_77 AC 7 ms
10,844 KB
testcase_78 AC 12 ms
11,560 KB
testcase_79 AC 12 ms
11,368 KB
testcase_80 AC 12 ms
11,752 KB
testcase_81 AC 5 ms
9,496 KB
testcase_82 AC 6 ms
10,316 KB
testcase_83 AC 4 ms
8,720 KB
testcase_84 AC 12 ms
12,504 KB
testcase_85 AC 12 ms
12,088 KB
testcase_86 AC 7 ms
11,076 KB
testcase_87 WA -
testcase_88 AC 7 ms
10,868 KB
testcase_89 AC 7 ms
10,772 KB
testcase_90 WA -
testcase_91 AC 12 ms
11,660 KB
testcase_92 AC 8 ms
11,132 KB
testcase_93 AC 12 ms
12,008 KB
testcase_94 AC 22 ms
13,568 KB
testcase_95 AC 22 ms
14,296 KB
testcase_96 AC 22 ms
13,892 KB
testcase_97 AC 22 ms
14,584 KB
testcase_98 AC 22 ms
15,836 KB
testcase_99 WA -
testcase_100 AC 22 ms
14,000 KB
testcase_101 WA -
testcase_102 AC 12 ms
11,772 KB
testcase_103 AC 22 ms
13,660 KB
testcase_104 AC 22 ms
13,552 KB
testcase_105 AC 22 ms
13,640 KB
testcase_106 AC 22 ms
13,600 KB
testcase_107 AC 22 ms
13,620 KB
testcase_108 AC 23 ms
13,592 KB
testcase_109 AC 22 ms
13,588 KB
testcase_110 AC 22 ms
13,616 KB
testcase_111 AC 22 ms
13,592 KB
testcase_112 AC 22 ms
13,588 KB
testcase_113 WA -
testcase_114 AC 22 ms
13,688 KB
testcase_115 AC 22 ms
13,560 KB
testcase_116 AC 22 ms
13,664 KB
testcase_117 AC 22 ms
13,640 KB
testcase_118 AC 22 ms
13,588 KB
testcase_119 AC 22 ms
13,712 KB
testcase_120 AC 23 ms
13,632 KB
testcase_121 AC 22 ms
13,624 KB
testcase_122 AC 22 ms
13,636 KB
testcase_123 AC 22 ms
13,632 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 Data.Char

main = do
  n <- getLine
  k <- getLine
  let r = [2,8,5,7,1,4]
  
  print $ r !! ((powerMod (modBigInteger n 6) (modBigInteger k 6) 6 + 5) `mod` 6)

modBigInteger :: String -> Int -> Int
modBigInteger [] _ = 0
modBigInteger xs m = foldl (\x y -> (x*10 + y) `mod` m) 0 (map digitToInt xs)

powerMod :: Integral a => a -> a -> a -> a
powerMod n 0 m = 1
powerMod n 1 m = n `mod` m
powerMod n p m = ((k * k) `mod` m * (if mod p 2 == 0 then 1 else n)) `mod` m
  where
    k = powerMod n (div p 2) m

0