結果
問題 |
No.251 大きな桁の復習問題(1)
|
ユーザー |
![]() |
提出日時 | 2015-12-06 22:31:27 |
言語 | Haskell (9.10.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 358 bytes |
コンパイル時間 | 6,219 ms |
コンパイル使用メモリ | 174,204 KB |
実行使用メモリ | 50,752 KB |
最終ジャッジ日時 | 2024-09-14 16:05:13 |
合計ジャッジ時間 | 9,735 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 9 TLE * 1 -- * 11 |
コンパイルメッセージ
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
ソースコード
modexp :: Integral a => a -> a -> a -> a modexp b ex m | ex == 0 = 1 | even ex = flip mod m $ square $ flip mod m $ modexp b (div ex 2) m | otherwise = flip mod m $ mod b m * (flip mod m $ modexp b (ex - 1) m) where square x = x * x main :: IO () main = print . (\(n : m : _) -> modexp n m 129402307) . map read . lines =<< getContents