結果
| 問題 |
No.64 XORフィボナッチ数列
|
| コンテスト | |
| ユーザー |
koukonko
|
| 提出日時 | 2015-12-07 17:42:15 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 734 bytes |
| コンパイル時間 | 2,380 ms |
| コンパイル使用メモリ | 74,420 KB |
| 実行使用メモリ | 50,384 KB |
| 最終ジャッジ日時 | 2024-09-14 18:27:57 |
| 合計ジャッジ時間 | 3,864 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 4 |
ソースコード
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
try {
String[] box = buff.readLine().split(" ");
long[] f = new long[2];
f[0] = Long.parseLong(box[0]);
f[1] = Long.parseLong(box[1]);
int n = Integer.parseInt(box[2]);
if (n < 2) {
System.out.println(f[n]);
return;
}
int now = 1;
while (now++ < n) {
long w = f[0]^ f[1];
f[0] = f[1];
f[1] = w;
}
System.out.println(f[1]);
} catch (NumberFormatException e) {
e.getStackTrace();
} catch (IOException e) {
e.getStackTrace();
}
}
}
koukonko