結果
| 問題 | 
                            No.2391 SAN 値チェック
                             | 
                    
| コンテスト | |
| ユーザー | 
                             lam6er
                         | 
                    
| 提出日時 | 2025-04-16 00:41:26 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,018 bytes | 
| コンパイル時間 | 273 ms | 
| コンパイル使用メモリ | 82,908 KB | 
| 実行使用メモリ | 81,244 KB | 
| 最終ジャッジ日時 | 2025-04-16 00:45:25 | 
| 合計ジャッジ時間 | 2,255 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 WA * 14 | 
ソースコード
MOD = 998244353
def main():
    import sys
    input = sys.stdin.read
    N = int(input().strip())
    
    max_n = N
    fact = [1] * (max_n + 1)
    for i in range(1, max_n + 1):
        fact[i] = fact[i-1] * i % MOD
    
    inv_fact = [1] * (max_n + 1)
    inv_fact[max_n] = pow(fact[max_n], MOD-2, MOD)
    for i in range(max_n - 1, -1, -1):
        inv_fact[i] = inv_fact[i+1] * (i+1) % MOD
    
    result = [0] * (N + 1)
    for i in range(0, N + 1):
        if i == 0:
            result[i] = 0
        else:
            exponent = (N - i) % 2
            sign = 1 if exponent == 0 else MOD - 1
            if N - 1 < i - 1:
                comb = 0
            else:
                comb = fact[N-1] * inv_fact[i-1] % MOD
                comb = comb * inv_fact[N - i] % MOD
            denominator = inv_fact[N - i]
            a_i = sign * comb % MOD
            a_i = a_i * denominator % MOD
            result[i] = a_i
    
    for res in result:
        print(res)
if __name__ == "__main__":
    main()
            
            
            
        
            
lam6er