結果
| 問題 | No.64 XORフィボナッチ数列 |
| コンテスト | |
| ユーザー |
ふう
|
| 提出日時 | 2015-01-15 18:39:15 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,708 ms / 5,000 ms |
| コード長 | 625 bytes |
| 記録 | |
| コンパイル時間 | 719 ms |
| コンパイル使用メモリ | 103,476 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2026-03-06 17:23:56 |
| 合計ジャッジ時間 | 5,137 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
from main.cpp:3:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at main.cpp:40:11:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
212 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:23:19: note: 'ans' was declared here
23 | long long ans;
| ^~~
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <map>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <iomanip>
#define INF 1050000000
using namespace std;
int main(void)
{
long long f0, f1, n;
long long ans;
cin >> f0 >> f1 >> n;
if (n == 0) {
cout << f0 << endl;
return (0);
}
if (n == 1) {
cout << f1 << endl;
return (0);
}
for (int i = 2; i <= n; i++) {
ans = f0 ^ f1;
f0 = f1;
f1 = ans;
}
cout << ans << endl;
return (0);
}
ふう