結果

問題 No.3168 [Cherry 7th Tune D] Manhole
ユーザー Naru820
提出日時 2025-05-30 23:56:41
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 846 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 3,640 ms
コンパイル使用メモリ 271,904 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-30 23:56:58
合計ジャッジ時間 16,372 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll inf = 2e18;
constexpr ll mod = 998244353;

ll t,a,b,c;
ll ppow(ll x, ll y, ll p) {
    ll res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1) {
            res = (res * x) % p;
        }
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int main(){
    cin >> t;
    while(t--){
        cin >> a >> b >> c;
        ll cinv = ppow(c, mod - 2, mod);
        ll sum = a * a + b * b + c * c;
        sum %= mod;
        sum = (sum * cinv) % mod;
        sum = (sum * cinv) % mod;
        cout << sum << endl;
    }
}
0