結果
| 問題 | No.251 大きな桁の復習問題(1) |
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2015-12-06 22:31:27 |
| 言語 | Haskell (9.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 358 bytes |
| 記録 | |
| コンパイル時間 | 1,772 ms |
| コンパイル使用メモリ | 194,688 KB |
| 実行使用メモリ | 35,764 KB |
| 最終ジャッジ日時 | 2026-04-04 13:38:10 |
| 合計ジャッジ時間 | 57,519 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 TLE * 1 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/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
はむ吉🐹