結果

問題 No.64 XORフィボナッチ数列
ユーザー kano_townkano_town
提出日時 2014-11-21 14:47:42
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 440 bytes
コンパイル時間 2,904 ms
コンパイル使用メモリ 72,028 KB
実行使用メモリ 60,252 KB
最終ジャッジ日時 2023-08-30 22:09:28
合計ジャッジ時間 10,722 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
60,252 KB
testcase_01 AC 116 ms
55,708 KB
testcase_02 AC 116 ms
56,096 KB
testcase_03 AC 117 ms
55,868 KB
testcase_04 AC 114 ms
56,504 KB
testcase_05 AC 110 ms
55,880 KB
testcase_06 AC 115 ms
56,404 KB
testcase_07 AC 116 ms
56,028 KB
testcase_08 AC 112 ms
55,968 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yukicoder64 {

	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 = 0;
		
		if (N == 0) fn = f0;
		else if (N == 1) fn = f1;
		else {
			for (long i = 2; i <= N; i++) {
				fn = f0 ^ f1;
				f0 = f1;
				f1 = fn;
			}
		}
		System.out.println(fn);
	}
}
0