結果
問題 |
No.2649 [Cherry 6th Tune C] Anthem Flower
|
ユーザー |
![]() |
提出日時 | 2024-02-25 15:51:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 119 ms / 2,000 ms |
コード長 | 460 bytes |
コンパイル時間 | 1,930 ms |
コンパイル使用メモリ | 192,112 KB |
最終ジャッジ日時 | 2025-02-19 21:19:01 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main() { fast_io(); int t; cin >> t; for (; t--;) { string n; long long m; cin >> n >> m; long long ans = 0; for (char c : n) { ans = (ans * 10 + (c - '0')) % (2 * m); } ans = (ans + 1) * ans % (2 * m) / 2; cout << ans << "\n"; } }