結果
問題 | No.2699 Simple Math (Returned) |
ユーザー |
![]() |
提出日時 | 2024-03-30 01:15:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 117 ms / 2,000 ms |
コード長 | 664 bytes |
コンパイル時間 | 2,134 ms |
コンパイル使用メモリ | 194,660 KB |
最終ジャッジ日時 | 2025-02-20 15:47:03 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 11 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> using namespace std; using mint = atcoder::modint998244353; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main() { fast_io(); int t; cin >> t; for (; t--;) { int n, m; cin >> n >> m; if (n <= m) { mint ans = mint(10).pow(n) - 1; cout << ans.val() << "\n"; continue; } int p = n / m, r = n % m; mint ans = mint(10).pow(r); if (p % 2) { ans *= -1; ans += mint(10).pow(m) + 1; } ans--; cout << ans.val() << "\n"; } }