結果
| 問題 |
No.64 XORフィボナッチ数列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-31 01:31:53 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 520 bytes |
| コンパイル時間 | 1,922 ms |
| コンパイル使用メモリ | 194,964 KB |
| 最終ジャッジ日時 | 2025-02-20 16:05:01 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 RE * 4 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:25:11: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
25 | system("pause");
| ~~~~~~^~~~~~~~~
ソースコード
// コピーして使う!
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<long long>;
int main() {
ll a, b, n;
cin >> a >> b >> n;
if (n == 0) {
cout << a << endl;
}
else if (n == 1) {
cout << b << endl;
} else {
vll f(n + 1);
f[0] = a;
f[1] = b;
for (ll i = 2; i < f.size(); i++) {
f[i] = f[i - 1] xor f[i - 2];
}
cout << f[f.size() - 1] << endl;
}
system("pause");
}