結果

問題 No.303 割れません
ユーザー 👑 kmjpkmjp
提出日時 2015-11-14 01:25:44
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 4,098 ms / 10,000 ms
コード長 293 bytes
コンパイル時間 525 ms
コンパイル使用メモリ 78,124 KB
実行使用メモリ 169,876 KB
最終ジャッジ日時 2023-10-11 17:36:57
合計ジャッジ時間 35,271 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
76,020 KB
testcase_01 AC 76 ms
75,828 KB
testcase_02 AC 76 ms
75,896 KB
testcase_03 AC 1,334 ms
102,936 KB
testcase_04 AC 4,098 ms
169,876 KB
testcase_05 AC 4,008 ms
169,232 KB
testcase_06 AC 4,028 ms
169,184 KB
testcase_07 AC 3,117 ms
152,604 KB
testcase_08 AC 3,318 ms
152,968 KB
testcase_09 AC 3,263 ms
152,820 KB
testcase_10 AC 75 ms
76,072 KB
testcase_11 AC 4,059 ms
169,324 KB
testcase_12 AC 3,324 ms
153,104 KB
testcase_13 AC 1,351 ms
117,156 KB
testcase_14 AC 725 ms
95,620 KB
testcase_15 AC 445 ms
85,856 KB
testcase_16 AC 75 ms
75,792 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
		a,b,c,d=a*a+b*b,a*b+b*d,c*a+d*b,c*b+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