結果
| 問題 | 
                            No.1510 Simple Integral
                             | 
                    
| コンテスト | |
| ユーザー | 
                             遭難者
                         | 
                    
| 提出日時 | 2021-03-31 12:30:20 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 982 bytes | 
| コンパイル時間 | 2,243 ms | 
| コンパイル使用メモリ | 79,824 KB | 
| 実行使用メモリ | 56,568 KB | 
| 最終ジャッジ日時 | 2024-09-14 22:58:17 | 
| 合計ジャッジ時間 | 10,222 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 12 WA * 31 | 
ソースコード
import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) {
        var sc = new Scanner(System.in);
        int n = sc.nextInt();
        var a = new long[n];
        Arrays.setAll(a , i -> sc.nextLong());
        long s = 0;
        for (int i = 0; i < n; i++) {
            long t = a[i];
            for (int j = 0; j < n; j++) {
                if (i != j) {
                    t *= (a[j] * a[j] - a[i] * a[i]) % mod;
                    t %= mod;
                }
            }
            if (t < 0)
                t += mod;
            s += inv(t);
            s %= mod;
        }
        System.out.println(s);
    }
    public static long mod = 998244353;
    static long inv(long a) {
        return mp(a, mod - 2);
    }
    static long mp(long a, long b) {
        if (b == 0)
            return 1;
        if ((b & 1) == 1)
            return (a * mp(a, b - 1)) % mod;
        return mp((a * a) % mod, b >> 1);
    }
}
            
            
            
        
            
遭難者