結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー Xinyuan Huang
提出日時 2024-10-28 18:51:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 350 bytes
コンパイル時間 1,777 ms
コンパイル使用メモリ 167,552 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-28 18:51:29
合計ジャッジ時間 6,324 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#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