結果

問題 No.64 XORフィボナッチ数列
ユーザー dazydazy
提出日時 2016-09-09 00:18:05
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 622 bytes
コンパイル時間 2,793 ms
コンパイル使用メモリ 74,204 KB
実行使用メモリ 59,632 KB
最終ジャッジ日時 2024-04-27 18:19:05
合計ジャッジ時間 10,387 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
53,572 KB
testcase_01 AC 113 ms
53,920 KB
testcase_02 AC 98 ms
52,776 KB
testcase_03 AC 110 ms
54,072 KB
testcase_04 AC 101 ms
52,376 KB
testcase_05 AC 96 ms
52,524 KB
testcase_06 AC 100 ms
52,608 KB
testcase_07 AC 109 ms
53,644 KB
testcase_08 AC 111 ms
53,704 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        long F0 = scan.nextLong();
        long F1 = scan.nextLong();
        long N = scan.nextLong();
        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