結果

問題 No.2699 Simple Math (Returned)
ユーザー kokoseikokosei
提出日時 2024-03-29 21:06:14
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 590 bytes
コンパイル時間 711 ms
コンパイル使用メモリ 77,164 KB
実行使用メモリ 13,480 KB
最終ジャッジ日時 2024-03-29 21:06:24
合計ジャッジ時間 4,662 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;
using ll = long long;
int mod = 998244353;

int N, M;
void solve(){
    cin >> N >> M;
    N %= 2 * M;
    if(N < M){
        ll ans = 0;
        for(int i = 0;i < N;i++)ans = (ans * 10 + 9) % mod;
        cout << ans << "\n";
        return;
    }
    ll ans = 0;
    for(int i = 0;i < M - (N - M);i++)ans = (ans * 10 + 9) % mod;
    for(int i = 0;i < N - M;i++)ans = (ans * 10) % mod;
    cout << ans << "\n";
}
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t; cin >> t;
    while(t--)solve();
    return 0;
}
0