結果

問題 No.2699 Simple Math (Returned)
ユーザー t98slider
提出日時 2024-04-03 06:52:29
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 4,279 ms
コンパイル使用メモリ 250,944 KB
最終ジャッジ日時 2025-02-20 19:47:55
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using mint = atcoder::modint998244353;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;
    cin >> T;
    while(T--){
        int n, m;
        cin >> n >> m;
        n %= 2 * m;
        if(n == 0){
            cout << 0 << '\n';
            continue;
        }
        mint ans;
        ans += mint(10).pow(min(n, m)) - 1;
        if(n > m) ans -= mint(10).pow(n - m) - 1;
        cout << ans.val() << '\n'; 
    }
}
0