結果

問題 No.64 XORフィボナッチ数列
ユーザー koukonkokoukonko
提出日時 2015-12-07 18:21:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 849 bytes
コンパイル時間 1,874 ms
コンパイル使用メモリ 71,336 KB
実行使用メモリ 49,876 KB
最終ジャッジ日時 2023-10-12 20:07:10
合計ジャッジ時間 3,216 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,508 KB
testcase_01 AC 43 ms
49,876 KB
testcase_02 AC 43 ms
49,816 KB
testcase_03 AC 44 ms
49,476 KB
testcase_04 AC 44 ms
49,652 KB
testcase_05 AC 44 ms
49,760 KB
testcase_06 AC 43 ms
49,720 KB
testcase_07 AC 43 ms
49,756 KB
testcase_08 AC 43 ms
49,812 KB
testcase_09 AC 44 ms
49,512 KB
testcase_10 AC 44 ms
49,696 KB
testcase_11 AC 43 ms
49,572 KB
testcase_12 AC 43 ms
49,572 KB
testcase_13 AC 43 ms
49,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

		try {
			String[] box = buff.readLine().split(" ");
			BigInteger[] f = new BigInteger[2];
			f[0] = new BigInteger(box[0]);
			f[1] = new BigInteger(box[1]);
			BigInteger n = new BigInteger(box[2]);

			if ((n.remainder(new BigInteger("3")).intValue()) < 2) {
				System.out.println(f[(n.remainder(new BigInteger("3")).intValue())]);
			} else {
				BigInteger w = f[0].xor(f[1]);
				System.out.println(w);
			}

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