結果

問題 No.2699 Simple Math (Returned)
ユーザー kotatsugamekotatsugame
提出日時 2024-03-29 21:20:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 413 bytes
コンパイル時間 692 ms
コンパイル使用メモリ 67,280 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-09-30 15:32:04
合計ジャッジ時間 3,625 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cassert>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int T;cin>>T;
	for(;T--;)
	{
		int N,M;
		cin>>N>>M;
		N%=2*M;
		if(N<=M)
		{
			cout<<(mint(10).pow(N)-1).val()<<"\n";
		}
		else
		{
			mint ans=mint(10).pow(M)-1;
			ans-=mint(10).pow(N-M)-1;
			cout<<ans.val()<<"\n";
		}
	}
}
0