結果

問題 No.64 XORフィボナッチ数列
ユーザー MamonboMamonbo
提出日時 2015-06-21 16:30:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 526 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 10,576 KB
実行使用メモリ 7,908 KB
最終ジャッジ日時 2023-09-21 22:45:11
合計ジャッジ時間 2,278 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,848 KB
testcase_01 AC 14 ms
7,872 KB
testcase_02 AC 14 ms
7,828 KB
testcase_03 AC 14 ms
7,772 KB
testcase_04 AC 14 ms
7,844 KB
testcase_05 AC 14 ms
7,848 KB
testcase_06 AC 14 ms
7,852 KB
testcase_07 AC 13 ms
7,844 KB
testcase_08 AC 14 ms
7,848 KB
testcase_09 AC 14 ms
7,908 KB
testcase_10 AC 14 ms
7,772 KB
testcase_11 AC 14 ms
7,788 KB
testcase_12 AC 15 ms
7,796 KB
testcase_13 AC 14 ms
7,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding=UTF-8
#普通に漸化式追ったら確実にTLEになるよね
#pythonではXORは^ね

#n   |0|1|2|3|4|5|6|7|
#F_0 |1|0|1|1|0|1|1|0|
#F_1 |0|1|1|0|1|1|0|1|

#周期性だーー (ドコドココドコドドコドコ)
#F_n=F_0 (when n ≡ 0),F_1 (when n ≡ 1),F_2=F_1^F_0 (when n ≡ 2) (mod 3)
#ここからコード始まります
mojir=input()
hyo=mojir.split(" ")
Fzero=int(hyo[0])
Fone=int(hyo[1])
N=int(hyo[2])

amari=N%3
if amari==0:
    print(Fzero)
elif amari==1:
    print(Fone)
else:
    print(Fzero^Fone)
0