結果
問題 |
No.403 2^2^2
|
ユーザー |
![]() |
提出日時 | 2016-07-28 16:00:05 |
言語 | Haskell (9.10.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 390 bytes |
コンパイル時間 | 6,004 ms |
コンパイル使用メモリ | 172,032 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-06 18:10:46 |
合計ジャッジ時間 | 3,165 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 WA * 4 |
コンパイルメッセージ
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 ded = 10^9 + 6 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 ded) dee putStrLn (show r1 ++ " " ++ show r2)