結果

問題 No.64 XORフィボナッチ数列
ユーザー jimanojimano
提出日時 2018-02-04 16:15:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 671 bytes
コンパイル時間 4,594 ms
コンパイル使用メモリ 71,920 KB
実行使用メモリ 49,460 KB
最終ジャッジ日時 2023-09-12 16:01:49
合計ジャッジ時間 6,012 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,120 KB
testcase_01 AC 43 ms
49,248 KB
testcase_02 AC 42 ms
49,240 KB
testcase_03 AC 43 ms
49,460 KB
testcase_04 AC 43 ms
49,120 KB
testcase_05 AC 43 ms
49,092 KB
testcase_06 AC 43 ms
49,136 KB
testcase_07 AC 42 ms
49,220 KB
testcase_08 AC 42 ms
49,220 KB
testcase_09 AC 42 ms
49,220 KB
testcase_10 AC 42 ms
49,316 KB
testcase_11 AC 43 ms
49,224 KB
testcase_12 AC 43 ms
49,404 KB
testcase_13 AC 43 ms
49,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.lv1_5;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No0064 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String[] str = br.readLine().split(" ");
			long f0 = Long.parseLong(str[0]);
			long f1 = Long.parseLong(str[1]);
			long n = Long.parseLong(str[2]);

			System.out.println(xor(f1, f0, n));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	static long xor(long f1, long f0, long n) {

		if (n % 3 == 0) {
			return f0;
		} else if (n % 3 == 1) {
			return f1;
		}
		return f1 ^ f0;
	}
}
0