結果
問題 | No.2699 Simple Math (Returned) |
ユーザー |
![]() |
提出日時 | 2024-09-16 19:56:16 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 745 bytes |
コンパイル時間 | 12,946 ms |
コンパイル使用メモリ | 379,384 KB |
実行使用メモリ | 6,144 KB |
最終ジャッジ日時 | 2024-09-16 19:56:36 |
合計ジャッジ時間 | 18,665 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 WA * 6 |
ソースコード
use proconio::input;fn fast_pow_mod(mut base: u64, mut exp: u64, modulo: u64) -> u64 {if modulo == 1 { return 0; }let mut result = 1;base %= modulo;while exp > 0 {if exp % 2 == 1 {result = (result * base) % modulo;}exp /= 2;base = (base * base) % modulo;}result}fn main () {let modulo = 998244353;input! {t: u64,}for _ in 0..t {input! {n: u64,m: u64,}let n = n % (2*m);if n <= m {println!("{}", fast_pow_mod(10, n, modulo)-1);}else {println!("{}", fast_pow_mod(10, m, modulo)-fast_pow_mod(10, n-m, modulo))}}}