結果

問題 No.64 XORフィボナッチ数列
ユーザー koukonkokoukonko
提出日時 2015-12-07 17:32:48
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 689 bytes
コンパイル時間 2,020 ms
コンパイル使用メモリ 71,256 KB
実行使用メモリ 51,252 KB
最終ジャッジ日時 2023-10-12 20:05:50
合計ジャッジ時間 3,505 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,232 KB
testcase_01 AC 43 ms
49,748 KB
testcase_02 AC 43 ms
49,404 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 44 ms
49,464 KB
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
	public static void main(String[] args) {
		BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));

		try {
			String[] box = buff.readLine().split(" ");
			int[] f = new int[2];
			f[0] = Integer.parseInt(box[0]);
			f[1] = Integer.parseInt(box[1]);
			int n = Integer.parseInt(box[2]);
			if(n < 2){
				System.out.println(f[n]);
				return;
			}
			int now = 1;
			while(now++ < n){
				int w = f[0] ^ f[1];
				f[0] = f[1];
				f[1] = w;
			}
			System.out.println(f[1]);

		} catch (NumberFormatException e) {

		} catch (IOException e) {

		}
	}
}
0