Submission #00003


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define gcd(x,y) __gcd(x,y) //最大公約数
#define lcm(x,y) x/(__gcd(x,y))*y //最小公倍数
int main() {
ll n, a = 1, b = 1, c = 2;
cin >> n;
for (int i = 0; i < n - 3; i++) {
a = b;
b = c;
c = a + b;
}
if (n == 1 || n == 2) {
cout << 1 << "\n";
} else {
cout << c << "\n";
}
return(0);
}

ステータス

項目 データ
問題 0002 - ハローキティーのあずきバー工場
ユーザー名 woody_1227
投稿日時 2022-08-11 06:17:36
言語 C++17
状態 Accepted
得点 30
ソースコード長 454 Byte
最大実行時間 29 ms
最大メモリ使用量 692 KB

セット

セット 得点 Cases
1 ALL 30 / 30 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
test01.txt AC 24 ms 472 KB
1
test02.txt AC 21 ms 448 KB
1
test03.txt AC 21 ms 548 KB
1
test04.txt AC 25 ms 516 KB
1
test05.txt AC 24 ms 492 KB
1
test06.txt AC 20 ms 464 KB
1
test07.txt AC 22 ms 692 KB
1
test08.txt AC 29 ms 536 KB
1