結果

問題 No.1510 Simple Integral
ユーザー gew1fw
提出日時 2025-06-12 20:42:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 500 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 81,788 KB
実行使用メモリ 60,140 KB
最終ジャッジ日時 2025-06-12 20:42:45
合計ジャッジ時間 3,780 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

n = int(input())
a = list(map(int, input().split()))

a_squared = [(x * x) % MOD for x in a]

sum_result = 0

for i in range(n):
    product = 1
    ai_sq = a_squared[i]
    ai = a[i]
    for k in range(n):
        if k != i:
            term = (a_squared[k] - ai_sq) % MOD
            product = (product * term) % MOD
    denominator = (ai * product) % MOD
    inv_denominator = pow(denominator, MOD - 2, MOD)
    sum_result = (sum_result + inv_denominator) % MOD

print(sum_result)
0