結果

問題 No.2699 Simple Math (Returned)
ユーザー daiotadaiota
提出日時 2024-03-30 00:44:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 651 bytes
コンパイル時間 1,681 ms
コンパイル使用メモリ 167,516 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-30 00:44:16
合計ジャッジ時間 7,518 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 WA -
testcase_02 AC 422 ms
6,548 KB
testcase_03 AC 339 ms
6,548 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define REP(i,n) for(int i=0;i<int(n);i++)


const ll MOD=998244353;

ll modpow(ll x,ll n){
    ll res=1;
    while(n!=0LL){
	if(n%2!=0LL) res=(res*x)%MOD;
	x=(x*x)%MOD;
	n/=2;
   }
    return res;
}



int main(){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
    int i,j,k;


    int T;
     cin >> T;
     while(T--){

    	 ll M,N;
    	 cin >> N >> M;


    	 ll x=N%(2*M);

    	 ll a=(modpow(10,x)-1+MOD)%MOD;
    	 ll b=(2*MOD-modpow(10,x-M)-1)%MOD;

    	 if(x<M) cout << a << endl;
    	 else cout << b << endl;


     }



	return 0;

}
0