結果
問題 | No.2007 Arbitrary Mod (Easy) |
ユーザー |
|
提出日時 | 2022-08-12 15:32:36 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 517 bytes |
コンパイル時間 | 12,198 ms |
コンパイル使用メモリ | 385,260 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 18:03:25 |
合計ジャッジ時間 | 14,944 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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);}