結果

問題 No.2699 Simple Math (Returned)
ユーザー kokoseikokosei
提出日時 2024-03-29 21:08:29
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 939 ms
コンパイル使用メモリ 81,772 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-29 21:08:33
合計ジャッジ時間 3,901 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 53 ms
6,676 KB
testcase_02 AC 100 ms
6,676 KB
testcase_03 AC 50 ms
6,676 KB
testcase_04 AC 121 ms
6,676 KB
testcase_05 AC 92 ms
6,676 KB
testcase_06 AC 79 ms
6,676 KB
testcase_07 AC 129 ms
6,676 KB
testcase_08 AC 110 ms
6,676 KB
testcase_09 AC 110 ms
6,676 KB
testcase_10 AC 109 ms
6,676 KB
testcase_11 AC 124 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <atcoder/modint>
using namespace std;
using ll = long long;
using mint = atcoder::modint998244353;

int N, M;
void solve(){
    cin >> N >> M;
    N %= 2 * M;
    if(N < M){
        cout << (mint::raw(10).pow(N) - 1).val() << "\n";
        return;
    }
    cout << ((mint::raw(10).pow(M - (N - M)) - 1) * mint::raw(10).pow(N - M)).val() << "\n";
}
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t; cin >> t;
    while(t--)solve();
    return 0;
}
0