結果

問題 No.3168 [Cherry 7th Tune D] Manhole
ユーザー テナガザル
提出日時 2025-05-30 22:16:32
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 896 ms / 2,000 ms
コード長 526 bytes
コンパイル時間 1,108 ms
コンパイル使用メモリ 99,692 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-05-30 22:16:48
合計ジャッジ時間 15,874 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long pow(long long a, long long k, long long m)
{
  long long ret = 1;
  for (a %= m; k > 0; k >>= 1, a = a * a % m) if (k & 1) ret = ret * a % m;
  return ret;
}

int main()
{
  const int mod = 998244353;
  int t;
  cin >> t;
  while (t--)
  {
    long long x, y, z;
    cin >> x >> y >> z;
    long long ans = x * x % mod + y * y % mod + z * z % mod;
    ans = ans % mod * pow(z, 2LL * mod - 4, mod) % mod;
    cout << ans << endl;
  }
}
0