結果
| 問題 | No.64 XORフィボナッチ数列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-03 19:02:28 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 305 bytes |
| 記録 | |
| コンパイル時間 | 328 ms |
| コンパイル使用メモリ | 57,964 KB |
| 最終ジャッジ日時 | 2026-04-04 11:05:21 |
| 合計ジャッジ時間 | 1,683 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge4_0 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main(int, const char**)':
main.cpp:7:9: error: 'uint64_t' was not declared in this scope
7 | uint64_t F0, F1, N, F2;
| ^~~~~~~~
main.cpp:2:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
1 | #include <iostream>
+++ |+#include <cstdint>
2 |
main.cpp:8:16: error: 'F0' was not declared in this scope
8 | cin >> F0 >> F1 >> N;
| ^~
main.cpp:8:22: error: 'F1' was not declared in this scope
8 | cin >> F0 >> F1 >> N;
| ^~
main.cpp:8:28: error: 'N' was not declared in this scope
8 | cin >> F0 >> F1 >> N;
| ^
main.cpp:14:22: error: expected ';' before 'i'
14 | for (uint64_t i = 2; i <= N; i++) {
| ^~
| ;
main.cpp:14:30: error: 'i' was not declared in this scope
14 | for (uint64_t i = 2; i <= N; i++) {
| ^
main.cpp:15:17: error: 'F2' was not declared in this scope
15 | F2 = F1 ^ F0;
| ^~
ソースコード
#include <iostream>
using namespace std;
int main(int argc, const char* argv[])
{
uint64_t F0, F1, N, F2;
cin >> F0 >> F1 >> N;
N %= 3;
if (N == 0) {
cout << F0 << endl;
return 0;
}
for (uint64_t i = 2; i <= N; i++) {
F2 = F1 ^ F0;
F0 = F1;
F1 = F2;
}
cout << F1 << endl;
return 0;
}