結果

問題 No.64 XORフィボナッチ数列
ユーザー dazydazy
提出日時 2016-09-09 01:00:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 627 bytes
コンパイル時間 3,235 ms
コンパイル使用メモリ 74,432 KB
実行使用メモリ 54,412 KB
最終ジャッジ日時 2024-04-27 18:23:03
合計ジャッジ時間 6,048 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
54,004 KB
testcase_01 AC 136 ms
54,412 KB
testcase_02 AC 130 ms
54,036 KB
testcase_03 AC 135 ms
54,096 KB
testcase_04 AC 132 ms
54,116 KB
testcase_05 AC 133 ms
54,156 KB
testcase_06 AC 132 ms
53,852 KB
testcase_07 AC 130 ms
54,148 KB
testcase_08 AC 127 ms
53,752 KB
testcase_09 AC 133 ms
54,092 KB
testcase_10 AC 131 ms
54,100 KB
testcase_11 AC 128 ms
53,952 KB
testcase_12 AC 135 ms
54,340 KB
testcase_13 AC 132 ms
54,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        long[] F = new long[3];
        F[0] = scan.nextLong();
        F[1] = scan.nextLong();
        long N = scan.nextLong();
        if (F[0] < 0||F[1] < 0||N > Math.pow(10d, 18)) System.exit(1);

        if (N==0) {
            System.out.println(F[0]);
            System.exit(0);
        } else {
            F[2] = F[0] ^ F[1];
            F[0] = F[1];
            F[1] = F[2];
            F[2] = F[0] ^ F[1];
            System.out.println(F[((int) ((N - 1) % 3L))]);
        }
    }
}
0