結果

問題 No.2699 Simple Math (Returned)
ユーザー t98slidert98slider
提出日時 2024-04-03 06:52:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 4,622 ms
コンパイル使用メモリ 262,380 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-03 06:52:37
合計ジャッジ時間 8,498 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 50 ms
6,676 KB
testcase_02 AC 97 ms
6,676 KB
testcase_03 AC 47 ms
6,676 KB
testcase_04 AC 117 ms
6,676 KB
testcase_05 AC 89 ms
6,676 KB
testcase_06 AC 82 ms
6,676 KB
testcase_07 AC 105 ms
6,676 KB
testcase_08 AC 105 ms
6,676 KB
testcase_09 AC 104 ms
6,676 KB
testcase_10 AC 105 ms
6,676 KB
testcase_11 AC 105 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

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