結果
問題 |
No.403 2^2^2
|
ユーザー |
![]() |
提出日時 | 2016-07-28 16:01:25 |
言語 | Haskell (9.10.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 407 bytes |
コンパイル時間 | 1,669 ms |
コンパイル使用メモリ | 171,904 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-06 18:10:49 |
合計ジャッジ時間 | 2,573 ms |
ジャッジサーバーID (参考情報) |
judge3 / 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 0 0 _ = 0 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)