結果
問題 |
No.2649 [Cherry 6th Tune C] Anthem Flower
|
ユーザー |
|
提出日時 | 2024-04-03 20:09:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 582 ms / 2,000 ms |
コード長 | 486 bytes |
コンパイル時間 | 4,313 ms |
コンパイル使用メモリ | 250,344 KB |
最終ジャッジ日時 | 2025-02-20 19:56:39 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; using ld = long double; using mint = modint998244353; void solve() { string N; cin >> N; ll M; cin >> M; int D = N.size(); ll S = (N[0] - '0') % (2 * M); for (int i = 1; i < D; i++) { S = (S * 10 + (N[i] - '0')) % (2 * M); } cout << (S * (S + 1)) % (2 * M) / 2 << endl; } int main() { int T; cin >> T; while (T--) { solve(); } return 0; }