結果
| 問題 |
No.303 割れません
|
| ユーザー |
|
| 提出日時 | 2016-02-11 16:24:45 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 454 bytes |
| コンパイル時間 | 182 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 15,616 KB |
| 最終ジャッジ日時 | 2024-09-22 00:39:30 |
| 合計ジャッジ時間 | 41,964 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 2 RE * 12 |
ソースコード
import sys
L = int(input())
if L == 2:
print("INF")
print(0)
sys.exit()
def matmul(a, b, c, d, x, y, z, w):
return (a * x + b * z, a * y + b * w, c * x + d * z, c * y + d * w)
def F(n):
x, y, z, w = 1, 0, 0, 1
a, b, c, d = 1, 1, 1, 0
while n > 0:
if n % 2 == 1: x, y, z, w = matmul(a, b, c, d, x, y, z, w)
a, b, c, d = matmul(a, b, c, d, a, b, c, d)
n //= 2
return z
way = F(L)
if L % 2 == 0: way -= F(L // 2) ** 2
print(L)
print(way)