結果
問題 |
No.2699 Simple Math (Returned)
|
ユーザー |
|
提出日時 | 2024-03-30 00:01:16 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 750 bytes |
コンパイル時間 | 20,663 ms |
コンパイル使用メモリ | 352,320 KB |
最終ジャッジ日時 | 2025-02-20 15:44:05 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 WA * 6 |
ソースコード
#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include<bits/stdc++.h> #include<atcoder/all> using namespace std; using namespace atcoder; using ll=long long; void IO(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); } long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } int main(){ IO(); ll t; cin>>t; ll mod=998244353; while(t--){ ll n,m; cin>>n>>m; n%=(2*m); if(n<=m){ cout<<(modpow(10,n,mod)-1+mod)%mod<<endl; }else{ cout<<(modpow(10,2*m-n,mod)-modpow(10,n-m,mod)+mod)%mod<<endl; } } }