結果
| 問題 |
No.2699 Simple Math (Returned)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-29 23:31:38 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,635 bytes |
| コンパイル時間 | 9,705 ms |
| コンパイル使用メモリ | 131,356 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-09-30 17:02:32 |
| 合計ジャッジ時間 | 5,766 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 TLE * 1 -- * 7 |
ソースコード
/*
*
* ^v^
*
*/
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <iomanip>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <climits>
#include <cstdlib>
#include <chrono>
using namespace std;
#define iamtefu ios_base::sync_with_stdio(false); cin.tie(0);
#define ll long long int
#define ld long double
#define fl(i,a,n) for (ll i(a); i<n; i++)
#define rfl(i,a,n) for (ll i(n-1); i>=a; i--)
#define print(a) for (auto x:a){cout<<x<<" ";} cout<<"\n";
#define tt int tt; cin>>tt; for(;tt--;)
template <typename T1, typename T2>
decltype(auto) max(T1 a, T2 b){return (a>b?a:b);}
template <typename T1, typename T2>
decltype(auto) min(T1 a, T2 b){return (a<b?a:b);}
ll gcd(ll a, ll b){
if (b==0){
return a;
}
return gcd(b, a%b);
}
ll pw(ll a, ll b, ll m){
ll res=1;
a%=m;
while (b){
if (b&1){
res=(res*a)%m;
}
a=(a*a)%m;
b>>=1;
}
return res;
}
const ll mod = 998244353;
void scn(){
ll n, m; cin>>n>>m;
if (n<=m){
cout<<(pw(10, n, mod)-1+mod)%mod<<'\n';
} else {
n%=(2*m);
if (n>m){
cout<<(((pw(10, n, mod)-1+mod)%mod)*(pw(10, (m-n)%m, mod)))%mod<<'\n';
} else {
cout<<((pw(10, n, mod)-1+mod)%mod)%mod<<'\n';
}
}
}
int main(){
iamtefu;
#if defined(airths)
auto t1=chrono::high_resolution_clock::now();
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
tt
{
scn();
}
#if defined(airths)
auto t2=chrono::high_resolution_clock::now();
ld ti=chrono::duration_cast<chrono::nanoseconds>(t2-t1).count();
ti*=1e-6;
cerr<<"Time: "<<setprecision(9)<<ti;
cerr<<"ms\n";
#endif
return 0;
}