結果
| 問題 | No.2007 Arbitrary Mod (Easy) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-12 15:32:36 |
| 言語 | Rust (1.97.1 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 0 ms / 2,000 ms |
| + 840µs | |
| コード長 | 517 bytes |
| 記録 | |
| コンパイル時間 | 4,295 ms |
| コンパイル使用メモリ | 187,884 KB |
| 実行使用メモリ | 9,792 KB |
| 最終ジャッジ日時 | 2026-09-02 16:05:25 |
| 合計ジャッジ時間 | 7,234 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
use std::io;
fn main() {
let mut input = String::new();
io::stdin()
.read_line(&mut input)
.expect("Failed to read line.");
let iv: Vec<&str> = input.split_whitespace().collect();
let mut a:u64 = iv[0].parse().unwrap();
let mut n:u64 = iv[1].parse().unwrap();
let mut ans:u64 = 1;
let m = 998244353;
while n > 0 {
if (n & 1) == 1 {
ans = ans * a % m;
}
a = a * a % m;
n >>= 1;
}
println!("{}\n{}", m, ans);
}