結果

問題 No.2699 Simple Math (Returned)
ユーザー aogeraaogera
提出日時 2024-03-30 16:18:05
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 509 ms / 2,000 ms
コード長 1,764 bytes
コンパイル時間 5,806 ms
コンパイル使用メモリ 308,552 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-30 16:18:18
合計ジャッジ時間 11,999 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 384 ms
6,676 KB
testcase_02 AC 479 ms
6,676 KB
testcase_03 AC 380 ms
6,676 KB
testcase_04 AC 509 ms
6,676 KB
testcase_05 AC 464 ms
6,676 KB
testcase_06 AC 447 ms
6,676 KB
testcase_07 AC 485 ms
6,676 KB
testcase_08 AC 485 ms
6,676 KB
testcase_09 AC 493 ms
6,676 KB
testcase_10 AC 486 ms
6,676 KB
testcase_11 AC 507 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include <atcoder/all>
using namespace std;using namespace atcoder;using vst = vector<string>;using ll = long long;
using ld = long double;using pll = pair<ll,ll>;using vll = vector<ll>;using vvll = vector<vll>;
using vpll = vector<pll>;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repp(i,k,n) for (ll i = k; i < n; i++)
#define per(i,s,e) for(ll i = s; i >= e; i--)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
#define no() {cout << "No" << endl; return 0;}
#define yes(){cout << "Yes" << endl;return 0;}
#define yesno(a) a ? cout << "Yes" << endl : cout << "No" << endl
#define YESNO(a) a ? cout << "YES" << endl : cout << "NO" << endl
#define MODD 998244353LL
#define MOD 1000000007LL
#define UNOmap unordered_map
#define UNOset unordered_set
#define ASC(T) T,vector<T>,greater<T>
#define join(G,a,b) G[a].push_back(b);G[b].push_back(a);
template<class... T>void in(T&... a){(cin >> ... >> a);}
template<class T, class... Ts>void out(const T& a, const Ts&... b){cout << a;((cout << ' ' <<  b), ...);cout << '\n';}
void vin(vll &v){for(ll i = 0; i < (ll)v.size(); i++)in(v[i]);}
void vout(vll &v){for(ll i = 0; i < (ll)v.size(); i++) cout << v[i] << ' ';}
ll INF = 1LL << 62;

// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

 using mint = modint998244353;
// using mint = modint1000000007;
// using mint = modint;


// cout << fixed << setprecision(15);
//----------------------------------------------



int main(){
   ll T;
   in(T);
   rep(i,T){
     ll N,M;
     in(N,M);
     ll k = N%(2*M);
     if(k <= M){
       out((mint(10).pow(k)-1).val());
     }
     else if(M < k){
       mint ans = mint(10).pow(M)-mint(10).pow(k-M);
       out(ans.val());
     }
     
   }
}
0