結果
問題 |
No.2649 [Cherry 6th Tune C] Anthem Flower
|
ユーザー |
|
提出日時 | 2024-02-23 22:53:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 486 bytes |
コンパイル時間 | 2,099 ms |
コンパイル使用メモリ | 193,388 KB |
最終ジャッジ日時 | 2025-02-19 20:25:55 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 34 |
ソースコード
#include <bits/stdc++.h> using namespace std; void solve() { string number; int m; cin >> number >> m; int n = 0; int residuo = 1; for (int i = (int)number.size() - 1; i >= 0; --i) { n = n + (residuo * (number[i] - '0')) % m; residuo = residuo * 10 % m; } long long result = (1ll * n * (n + 1))/ 2; cout << result % m << "\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int test = 1; cin >> test; while (test--) { solve(); } return 0; }