結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー eve__fuyuki
提出日時 2024-02-25 15:45:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 1,741 ms
コンパイル使用メモリ 193,680 KB
最終ジャッジ日時 2025-02-19 21:18:52
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#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')) % m;
        }
        ans = ans * (ans + 1) / 2 % m;
        cout << ans << "\n";
    }
}
0