結果

問題 No.2699 Simple Math (Returned)
ユーザー ripity
提出日時 2024-03-29 21:13:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 478 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 1,677 ms
コンパイル使用メモリ 195,444 KB
最終ジャッジ日時 2025-02-20 14:42:45
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#include <atcoder/modint>
using mint = atcoder::modint998244353;

void solve() {
  long long N, M;
  cin >> N >> M;
  long long r = N%(2*M);
  if(r == 0) {
    cout << 0 << endl;
  }else if(r <= M) {
    cout << mint(mint(10).pow(r) - mint(1)).val() << endl;
  }else {
    cout << mint(mint(mint(10).pow(2*M-r) - mint(1)) * mint(10).pow(r-M)).val() << endl;
  }
}

int main() {
  int T;
  cin >> T;
  while(T--) { solve(); }
}
0