結果

問題 No.64 XORフィボナッチ数列
ユーザー dazydazy
提出日時 2016-09-09 00:15:58
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 619 bytes
コンパイル時間 3,302 ms
コンパイル使用メモリ 74,688 KB
実行使用メモリ 54,984 KB
最終ジャッジ日時 2024-04-27 18:12:48
合計ジャッジ時間 5,882 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
53,936 KB
testcase_01 AC 136 ms
54,280 KB
testcase_02 AC 128 ms
53,840 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 138 ms
54,128 KB
testcase_13 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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

        if (N==0) {
            System.out.println(F0);
            System.exit(0);
        } else {
            long tmp;
            for (int i = 0; i < N - 1; i++) {
                tmp = F1;
                F1 = F0 ^ F1;
                F0 = tmp;
            }
            System.out.println(F1);
        }
    }
}
0