結果

問題 No.303 割れません
ユーザー pluto77pluto77
提出日時 2018-01-05 11:26:42
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 3,661 ms / 10,000 ms
コード長 309 bytes
コンパイル時間 663 ms
コンパイル使用メモリ 78,080 KB
実行使用メモリ 155,288 KB
最終ジャッジ日時 2023-08-24 20:15:45
合計ジャッジ時間 31,763 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
76,584 KB
testcase_01 AC 73 ms
76,148 KB
testcase_02 AC 74 ms
76,144 KB
testcase_03 AC 1,187 ms
98,492 KB
testcase_04 AC 3,661 ms
155,288 KB
testcase_05 AC 3,594 ms
154,744 KB
testcase_06 AC 3,583 ms
155,080 KB
testcase_07 AC 2,788 ms
140,484 KB
testcase_08 AC 2,989 ms
140,912 KB
testcase_09 AC 2,944 ms
140,416 KB
testcase_10 AC 73 ms
76,136 KB
testcase_11 AC 3,632 ms
154,620 KB
testcase_12 AC 3,002 ms
140,956 KB
testcase_13 AC 1,192 ms
112,544 KB
testcase_14 AC 622 ms
92,352 KB
testcase_15 AC 394 ms
85,444 KB
testcase_16 AC 72 ms
76,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki_303

def fib(n):
 if n<3:
	return 1
 n-=2
 a, b, c, d, x, y, = 1, 1, 1, 0, 1, 1
 while n>0:
	if n&1==1:
	 x,y=a*x+b*y,c*x+d*y
	a,b,c,d=a*a+b*c,b*(a+d),c*(a+d),b*c+d*d
	n/=2
 return x

l=int(raw_input())
if l==2:
 print 3
 print 'INF'
else:
 print l
 res=fib(l)
 if l%2==0:
  res-=fib(l/2)**2
 print res
0