結果

問題 No.64 XORフィボナッチ数列
ユーザー itezpace
提出日時 2016-08-21 12:52:43
言語 Java
(openjdk 23)
結果
MLE  
実行時間 -
コード長 498 bytes
コンパイル時間 2,291 ms
コンパイル使用メモリ 74,076 KB
実行使用メモリ 835,448 KB
最終ジャッジ日時 2024-11-07 22:25:08
合計ジャッジ時間 6,200 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 MLE * 1 -- * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Yuki64 {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
    long n = sc.nextLong();
    long x = 0;
    if(n>=2){
      x = fib(b,a,n);
    } else if(n==0){
      x = a;
    } else if(n==1){
      x = b;
    }
    System.out.println(x);
  }

  private static long fib(long b,long a,long n) {
    long c = b^a;
    n-=1;
    if(n==1) return c;
    return fib(c,b,n);
  }
}
0