結果

問題 No.2699 Simple Math (Returned)
ユーザー ripityripity
提出日時 2024-03-29 21:13:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 512 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 2,155 ms
コンパイル使用メモリ 203,996 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-29 21:13:35
合計ジャッジ時間 9,063 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 394 ms
6,676 KB
testcase_02 AC 471 ms
6,676 KB
testcase_03 AC 376 ms
6,676 KB
testcase_04 AC 512 ms
6,676 KB
testcase_05 AC 460 ms
6,676 KB
testcase_06 AC 444 ms
6,676 KB
testcase_07 AC 477 ms
6,676 KB
testcase_08 AC 475 ms
6,676 KB
testcase_09 AC 492 ms
6,676 KB
testcase_10 AC 477 ms
6,676 KB
testcase_11 AC 498 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

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