結果

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

ソースコード

diff #

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

long long mod = 998244353;
//入力が必ず-mod<a<modの時.
struct mint{
    long long v = 0;
    mint(){} mint(int a){v = a<0?a+mod:a;} mint(long long a){v = a<0?a+mod:a;}
    mint(unsigned long long a){v = a;}
    long long val(){return v;}
    void modu(){v %= mod;}
 
    mint &operator=(const mint &b) = default;
    mint operator-()const{return mint(0)-(*this);}
    mint operator+(const mint b)const{return mint(v)+=b;}
    mint operator-(const mint b)const{return mint(v)-=b;}
    mint operator*(const mint b)const{return mint(v)*=b;}
    mint operator/(const mint b)const{return mint(v)/=b;}
 
    mint operator+=(const mint b){
        v += b.v; if(v >= mod) v -= mod;
        return *this;
    }
    mint operator-=(const mint b){
        v -= b.v; if(v < 0) v += mod; 
        return *this;
    }   
    mint operator*=(const mint b){v = v*b.v%mod; return *this;}
    mint operator/=(mint b){
        if(b == 0) assert(false);
        int left = mod-2;
        while(left){if(left&1) *this *= b; b *= b; left >>= 1;}
        return *this;
    }
 
    mint operator++(){*this += 1; return *this;}
    mint operator--(){*this -= 1; return *this;}
    mint operator++(int){*this += 1; return *this;}
    mint operator--(int){*this -= 1; return *this;}
    bool operator==(const mint b)const{return v == b.v;}
    bool operator!=(const mint b)const{return v != b.v;}
    bool operator>(const mint b)const{return v > b.v;}
    bool operator>=(const mint b)const{return v >= b.v;}
    bool operator<(const mint b)const{return v < b.v;}
    bool operator<=(const mint b)const{return v <= b.v;}
 
    mint pow(long long n)const{
        mint ret = 1,p = v;
        if(n < 0) p = p.inv(),n = -n;
        while(n){
            if(n&1) ret *= p;
            p *= p; n >>= 1;
        }
        return ret;
    }
    mint inv()const{return mint(1)/v;}
};

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T; cin >> T;
    while(T--){
        mint a,b,c; cin >> a.v >> b.v >> c.v;
        mint answer = c*c+b*b+a*a;
        answer /= c*c;
        cout << answer.v << "\n";
    }   
}
0