結果
| 問題 | No.3578 隣接転倒数 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-05 15:46:38 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 325 bytes |
| 記録 | |
| コンパイル時間 | 2,519 ms |
| コンパイル使用メモリ | 95,856 KB |
| 実行使用メモリ | 79,336 KB |
| 最終ジャッジ日時 | 2026-07-05 15:46:44 |
| 合計ジャッジ時間 | 6,011 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 12 |
ソースコード
# https://yukicoder.me/problems/no/3578
def main():
N, B = map(int, input().split())
if B == 1:
print(0)
elif B % 2 == 0:
print("NaN")
else:
inv2 = pow(2, B - 2, B)
ans = (N - 1) * inv2
ans %= B
print(ans)
if __name__ == "__main__":
main()