結果

問題 No.2699 Simple Math (Returned)
ユーザー a01sa01toa01sa01to
提出日時 2024-03-30 00:36:03
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 503 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 3,003 ms
コンパイル使用メモリ 246,792 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-30 00:36:14
合計ジャッジ時間 10,186 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 370 ms
6,676 KB
testcase_02 AC 469 ms
6,676 KB
testcase_03 AC 395 ms
6,676 KB
testcase_04 AC 490 ms
6,676 KB
testcase_05 AC 457 ms
6,676 KB
testcase_06 AC 450 ms
6,676 KB
testcase_07 AC 475 ms
6,676 KB
testcase_08 AC 503 ms
6,676 KB
testcase_09 AC 483 ms
6,676 KB
testcase_10 AC 481 ms
6,676 KB
testcase_11 AC 487 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
  #define _GLIBCXX_DEBUG
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

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

inline void solve() {
  int n, m;
  cin >> n >> m;
  n %= 2 * m;
  if (m < n) {
    cout << (mint(10).pow(m) - mint(10).pow(n - m)).val() << endl;
  }
  else {
    cout << (mint(10).pow(n) - 1).val() << endl;
  }
}

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