結果

問題 No.64 XORフィボナッチ数列
ユーザー aaaaasatoriaaaaasatori
提出日時 2018-02-15 09:24:01
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 484 bytes
コンパイル時間 4,252 ms
コンパイル使用メモリ 70,944 KB
実行使用メモリ 59,936 KB
最終ジャッジ日時 2023-08-26 18:31:55
合計ジャッジ時間 12,463 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
56,352 KB
testcase_01 AC 109 ms
55,796 KB
testcase_02 AC 112 ms
55,696 KB
testcase_03 AC 110 ms
55,716 KB
testcase_04 AC 110 ms
56,172 KB
testcase_05 AC 107 ms
56,084 KB
testcase_06 AC 107 ms
55,556 KB
testcase_07 AC 109 ms
56,036 KB
testcase_08 AC 109 ms
55,700 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No64 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long F0 = sc.nextLong();
		long F1 = sc.nextLong();
		long N = sc.nextLong();
		long Fn = F0 ^ F1;
		long Fn1 = F1;
		long Fn2 = F0;
		
		for(int i = 3;i <= N;i++) {
			Fn2 = Fn1;
			Fn1 = Fn;
			Fn = Fn1 ^ Fn2;
		}
		
		if(N == 0) {
			System.out.println(F0);
		}else if(N == 1) {
			System.out.println(F1);
		}else {
			System.out.println(Fn);
		}
	}
}
0