結果

問題 No.303 割れません
ユーザー pluto77pluto77
提出日時 2018-01-05 11:02:16
言語 Python2
(2.7.18)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 416 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 6,660 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-08-24 20:13:10
合計ジャッジ時間 16,592 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,140 KB
testcase_01 AC 11 ms
5,916 KB
testcase_02 AC 10 ms
6,084 KB
testcase_03 AC 4,098 ms
8,348 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki_303

def mul(a,b):
 return [a[0]*b[0]+a[1]*b[2],
         a[0]*b[1]+a[1]*b[3],
         a[2]*b[0]+a[3]*b[2],
         a[2]*b[1]+a[3]*b[3]]

def fib(n):
 if n<=1:
  return n
 res=[1, 0, 0, 1]
 mx =[1, 1, 1, 0]
 while n>0:
  if n%2:
   res=mul(mx, res)
  mx=mul(mx, mx)
  n/=2
 return res[2]

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