結果
問題 |
No.403 2^2^2
|
ユーザー |
![]() |
提出日時 | 2016-07-28 15:54:26 |
言語 | Haskell (9.10.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 375 bytes |
コンパイル時間 | 2,124 ms |
コンパイル使用メモリ | 170,624 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-06 18:10:38 |
合計ジャッジ時間 | 3,152 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 18 |
コンパイルメッセージ
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
ソースコード
modPow a b d = loop 1 a b where loop x r 0 = x loop x r b = loop (if even b then x else (mod (x*r) d)) (mod (r*r) d) (div b 2) dee = 10^9 + 7 main = do li <- getLine let (a:b:c:_) = map read $ words $ map (\c -> if c == '^' then ' ' else c) li let r1 = modPow (modPow a b dee) c dee let r2 = modPow a (modPow b c dee) dee putStrLn (show r1 ++ " " ++ show r2)