結果

問題 No.303 割れません
ユーザー 👑 kmjpkmjp
提出日時 2015-11-14 01:30:28
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 3,529 ms / 10,000 ms
コード長 300 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 77,684 KB
実行使用メモリ 145,540 KB
最終ジャッジ日時 2023-10-11 17:37:28
合計ジャッジ時間 30,403 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,992 KB
testcase_01 AC 76 ms
75,972 KB
testcase_02 AC 75 ms
76,072 KB
testcase_03 AC 1,153 ms
95,368 KB
testcase_04 AC 3,505 ms
145,092 KB
testcase_05 AC 3,468 ms
144,920 KB
testcase_06 AC 3,457 ms
145,124 KB
testcase_07 AC 2,696 ms
131,960 KB
testcase_08 AC 2,908 ms
132,708 KB
testcase_09 AC 2,846 ms
131,552 KB
testcase_10 AC 75 ms
75,880 KB
testcase_11 AC 3,529 ms
145,540 KB
testcase_12 AC 2,925 ms
132,928 KB
testcase_13 AC 1,168 ms
110,528 KB
testcase_14 AC 592 ms
90,044 KB
testcase_15 AC 382 ms
84,296 KB
testcase_16 AC 74 ms
76,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

L=input()

def fib(L):
	if L<3:
		return 1
	v1=v2=a=b=c=1
	d=0
	L-=2
	while L:
		if L%2:
			v2,v1=a*v2+b*v1,c*v2+d*v1
		L /= 2
		bc=b*c
		a,b,c,d=a*a+bc,b*(a+d),c*(a+d),bc+d*d
	return v2


if L==2:
	print 3
	print "INF"
else:
	ret = fib(L)
	
	if L%2==0:
		ret -= fib(L/2)**2
	
	print L
	print ret
	
0