結果
| 問題 |
No.64 XORフィボナッチ数列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-08-21 12:49:48 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 486 bytes |
| コンパイル時間 | 3,316 ms |
| コンパイル使用メモリ | 73,928 KB |
| 実行使用メモリ | 41,504 KB |
| 最終ジャッジ日時 | 2024-11-07 22:25:02 |
| 合計ジャッジ時間 | 5,898 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 1 RE * 10 |
ソースコード
import java.util.Scanner;
class Yuki64 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int n = sc.nextInt();
int 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 int fib(int b,int a,int n) {
int c = b^a;
n-=1;
if(n==1) return c;
return fib(c,b,n);
}
}