結果
問題 | No.2816 At Most Two Moves |
ユーザー |
|
提出日時 | 2024-07-19 23:05:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 103 ms / 2,000 ms |
コード長 | 288 bytes |
コンパイル時間 | 309 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 65,408 KB |
最終ジャッジ日時 | 2024-07-19 23:05:07 |
合計ジャッジ時間 | 3,212 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 25 |
ソースコード
mod = 998244353 for _ in range(int(input())): N = int(input()) if N == 1: print(1) continue ans = 0 ans += (N + 1) * pow(2, N * (N - 1) // 2 - 1, mod) ans += pow(2, N * (N - 1) // 2 - (2 * N - 3), mod) * (N - 1) * (pow(4, N - 2, mod) - pow(3, N - 2, mod)) ans %= mod print(ans)