結果

問題 No.64 XORフィボナッチ数列
ユーザー koukonkokoukonko
提出日時 2015-12-07 17:42:15
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 734 bytes
コンパイル時間 1,997 ms
コンパイル使用メモリ 72,236 KB
実行使用メモリ 50,076 KB
最終ジャッジ日時 2023-10-12 20:06:13
合計ジャッジ時間 3,447 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,444 KB
testcase_01 AC 45 ms
49,528 KB
testcase_02 AC 45 ms
49,376 KB
testcase_03 AC 45 ms
49,384 KB
testcase_04 AC 44 ms
49,528 KB
testcase_05 AC 45 ms
49,584 KB
testcase_06 AC 44 ms
49,440 KB
testcase_07 AC 44 ms
49,260 KB
testcase_08 AC 45 ms
49,552 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 44 ms
49,444 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(" ");
			long[] f = new long[2];
			f[0] = Long.parseLong(box[0]);
			f[1] = Long.parseLong(box[1]);
			int n = Integer.parseInt(box[2]);
			if (n < 2) {
				System.out.println(f[n]);
				return;
			}
			int now = 1;
			while (now++ < n) {
				long w = f[0]^ f[1];
				f[0] = f[1];
				f[1] = w;
			}
			System.out.println(f[1]);

		} catch (NumberFormatException e) {
			e.getStackTrace();
		} catch (IOException e) {
			e.getStackTrace();
		}
	}
}
0