結果

問題 No.1510 Simple Integral
ユーザー pockynypockyny
提出日時 2021-05-14 23:00:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 784 bytes
コンパイル時間 638 ms
コンパイル使用メモリ 71,784 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 02:19:12
合計ジャッジ時間 1,965 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 8 ms
6,940 KB
testcase_24 AC 9 ms
6,940 KB
testcase_25 AC 9 ms
6,944 KB
testcase_26 AC 8 ms
6,940 KB
testcase_27 AC 8 ms
6,944 KB
testcase_28 AC 9 ms
6,940 KB
testcase_29 AC 9 ms
6,944 KB
testcase_30 AC 8 ms
6,944 KB
testcase_31 AC 8 ms
6,944 KB
testcase_32 AC 9 ms
6,940 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;
typedef long long ll;
ll mod = 998244353;
ll pw(ll a,ll x){
    ll ret = 1;
    while(x){
        if(x&1) (ret *= a) %= mod;
        (a *= a) %= mod; x /= 2;
    }
    return ret;
}

ll a[110];
int main(){
    int i,j,n; cin >> n;
    for(i=0;i<n;i++) cin >> a[i];
    ll ans = 0;
    for(i=0;i<n;i++){
        bool f = true;
        for(j=0;j<n;j++){
            if(j!=i && a[i]==a[j]) f = false;
        }
        if(!f) exit(1);
        if(!f) continue;
        ll val = pw(a[i],mod - 2);
        for(j=0;j<n;j++){
            if(j==i) continue;
            ll y = a[j]*a[j]%mod - a[i]*a[i]%mod + mod;
            y %= mod;
            (val *= pw(y,mod - 2)) %= mod; 
        }
        (ans += val) %= mod;
    }
    cout << ans << endl;
}
0