Submission
Status:
-----
Subtask/Task Score:
0/100
Score: 0
User: Sense.exe
Problemset: กังหันสี่ทิศ
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-01 11:47:02
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
if(n==0) {
cout << 0;
return 0;
}
if(n==1||n==2) {
cout << 1;
return 0;
}
long long a=1,b=1,c=0;
for(int i=3; i<=n; i++) {
c=a+b;
a=b;
b=c;
}
cout << c;
}
//time limit
// int Recur(long long n) {
// if(n==0) return 0;
// if(n==1) return 1;
// return Recur(n-1) + Recur(n-2);
// }
// int main() {
// long long n;
// cin >> n;
// if(n<=100&&n>=0) {
// cout << Recur(n);
// }
// }