結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
コンテスト
ユーザー Xinyuan Huang
提出日時 2024-10-28 18:51:23
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 55 ms / 2,000 ms
+ 355µs
コード長 350 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,463 ms
コンパイル使用メモリ 178,832 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-19 07:15:13
合計ジャッジ時間 6,733 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

using i64 = long long;

int main() {
	cin.tie(nullptr)->sync_with_stdio(false);
	int _; cin >> _;
	while (_--) {
		string s; cin >> s;
		i64 m; cin >> m;
		i64 res = 0;
		for (auto &ch : s)
			res = (res * 10 + ch - '0') % (m * 2);
		res = (res + 1) * res / 2;
		cout << res % m << '\n';
	}
	return 0;
}
0