結果

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

ソースコード

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