結果
問題 | No.403 2^2^2 |
ユーザー |
![]() |
提出日時 | 2020-07-26 22:58:49 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 695 bytes |
コンパイル時間 | 3,515 ms |
コンパイル使用メモリ | 180,396 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 19:34:06 |
合計ジャッジ時間 | 4,318 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
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
ソースコード
LANGUAGEimportqualifiedData.ByteString.CharasBSCimportqualifiedData.MaybeasMaybe# MOD 1000000007INLINEmodulus::Numa=>amodulus = MODrui::Integer->Integer->Integer->Integerrui 1 _ _ = 1rui _ 0 _ = 1rui a x p| even x = z * z `mod` p| otherwise = a * z * z `mod` pwhere z = rui a (x `div` 2) pmain::IO()main = doxs <- BSC8.split '^' <$> BSC8.getLinelet (a:b:c:_) = map (fst . Maybe.fromJust . BSC8.readInteger) xslet _a = a `mod`modulusputStr $ show $ rui (rui _a b modulus) c modulusputStr " "if _a == 0then print 0else print $ rui _a (rui b c (modulus - 1)) modulus