結果
問題 |
No.2649 [Cherry 6th Tune C] Anthem Flower
|
ユーザー |
|
提出日時 | 2024-02-26 01:15:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 679 bytes |
コンパイル時間 | 1,432 ms |
コンパイル使用メモリ | 169,808 KB |
実行使用メモリ | 7,032 KB |
最終ジャッジ日時 | 2024-09-29 11:31:39 |
合計ジャッジ時間 | 7,760 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 WA * 26 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i=0; i<n; i++) #define debug 0 #define YES cout << "Yes" << endl; #define NO cout << "No" << endl; using ll = long long; using ld = long double; const int mod = 998244353; const int MOD = 1000000007; const double pi = atan2(0, -1); #include <time.h> #include <chrono> int main() { int T; cin >> T; rep(test, T) { string n; ll M; cin >> n >> M; int k = n.size(); ll N = 0; vector<ll> ten(k); ten[0] = 1; rep(i, k - 1) { ten[i + 1] = ten[i] * 10; ten[i + 1] %= M; } rep(i, k) { N += (ll)(n[i] - '0') * ten[k - 1 - i]; N %= M; } cout << N * (N + 1) / 2 % M << endl; } }