結果

問題 No.64 XORフィボナッチ数列
ユーザー uafr_csuafr_cs
提出日時 2015-05-15 02:27:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 459 bytes
コンパイル時間 1,951 ms
コンパイル使用メモリ 71,292 KB
実行使用メモリ 56,324 KB
最終ジャッジ日時 2023-09-20 07:56:10
合計ジャッジ時間 4,830 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
56,324 KB
testcase_01 AC 125 ms
55,984 KB
testcase_02 AC 125 ms
55,836 KB
testcase_03 AC 129 ms
55,508 KB
testcase_04 AC 126 ms
55,972 KB
testcase_05 AC 125 ms
55,772 KB
testcase_06 AC 124 ms
55,776 KB
testcase_07 AC 123 ms
55,936 KB
testcase_08 AC 124 ms
56,160 KB
testcase_09 AC 124 ms
55,800 KB
testcase_10 AC 126 ms
55,780 KB
testcase_11 AC 125 ms
55,952 KB
testcase_12 AC 125 ms
55,956 KB
testcase_13 AC 127 ms
56,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	// xor の性質 (X ^ Y) ^ X = Y より, F0, F1, F0 ^ F1, F0, F1, ... とループする.
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		final long F0 = sc.nextLong();
		final long F1 = sc.nextLong();
		final long N = sc.nextLong();
		
		System.out.println(N % 3 == 0 ? F0 : N % 3 == 1 ? F1 : (F0 ^ F1));
		
		
	}
	
}
0