結果

問題 No.303 割れません
コンテスト
ユーザー pekempey
提出日時 2016-02-11 16:24:45
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
RE  
実行時間 -
コード長 454 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 292 ms
コンパイル使用メモリ 21,468 KB
実行使用メモリ 20,948 KB
最終ジャッジ日時 2026-09-02 01:15:03
合計ジャッジ時間 40,228 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 2 RE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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)
0