結果

問題 No.64 XORフィボナッチ数列
ユーザー shinshin
提出日時 2022-05-17 14:40:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 45 ms / 5,000 ms
コード長 842 bytes
コンパイル時間 5,679 ms
コンパイル使用メモリ 73,756 KB
実行使用メモリ 49,824 KB
最終ジャッジ日時 2023-10-13 12:23:49
合計ジャッジ時間 7,212 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
47,388 KB
testcase_01 AC 43 ms
49,824 KB
testcase_02 AC 43 ms
49,196 KB
testcase_03 AC 43 ms
49,260 KB
testcase_04 AC 43 ms
49,208 KB
testcase_05 AC 44 ms
49,300 KB
testcase_06 AC 45 ms
49,416 KB
testcase_07 AC 45 ms
49,388 KB
testcase_08 AC 45 ms
49,284 KB
testcase_09 AC 43 ms
49,500 KB
testcase_10 AC 43 ms
49,292 KB
testcase_11 AC 43 ms
49,192 KB
testcase_12 AC 44 ms
49,276 KB
testcase_13 AC 44 ms
49,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No64 {

	public static void main(String[] args) throws IOException{
		//XORフィボナッチ数列
		String[] text = readStr()[0].split(" ");
		Long F = Long.parseLong(text[0]) , FF = Long.parseLong(text[1]) , N = Long.parseLong(text[2]);
		
		switch(Math.floorMod(N, 3)) {
			case 1 : F = FF;
				break;
			case 2 : F = F ^ FF;
		}
		
		System.out.println(F);


	}
	
	public static String[] readStr() throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> list = new ArrayList<>();

		do {
			list.add(br.readLine());
		}while(br.ready());

		br.close();

		String[] text = new String[list.size()];
		list.toArray(text);

		return text;

	}

}
0