結果
問題 | No.2649 [Cherry 6th Tune C] Anthem Flower |
ユーザー |
|
提出日時 | 2024-03-04 00:21:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 113 ms / 2,000 ms |
コード長 | 500 bytes |
コンパイル時間 | 1,832 ms |
コンパイル使用メモリ | 193,048 KB |
最終ジャッジ日時 | 2025-02-20 00:40:08 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int T; cin >> T; while(T--){ string s; ll n = 0, m; cin >> s >> m; for(int i = 0; i < s.size(); i++){ n *= 10; n += s[i] - '0'; n %= 2 * m; } ll ans = n * (n + 1); while(ans % 2 != 0) ans += m; ans /= 2; ans %= m; cout << ans << '\n'; } }