#include<bits/stdc++.h>
using namespace std;
int a[20005],b[20005],c[20005];
int main(){
//a[i]=a[i-1]+a[i-2];
int n;
cin>>n;
a[0]=1;//加数1
b[0]=2;//加数2
int A=1;//数位长度
int jw=0;//进位
for(int i=3;i<=n;i++){//从第3个开始算
jw=0;
for(int j=0;j<A;j++){//做加法
c[j]=a[j]+b[j]+jw;
jw=c[j]/10;//大于等于10有进位
c[j]=c[j]%10;//保留个位
}
if(jw==1){//数位变多了
c[A]=1;
A++;//记录数位增加了
}
for(int k=0;k<A;k++){
a[k]=b[k];
b[k]=c[k];
}
}
if(n==1)
cout<<1;
else if(n==2)
cout<<2;
else {
for(int i=A-1;i>=0;i--)
cout<<c[i];
}
return 0;
}
RunID | User | Nick Name | Problem ID | Result | Memory | Time | Language | Code Length | Submit Time |
76617 | jzlb_txy | Coco is coo! | D | Accepted | 2256 KiB | 0 ms | C++ | 616 bytes | 2023-03-26 14:37:09 |
76612 | jzlb_txy | Coco is coo! | D | Accepted | 2256 KiB | 0 ms | C++ | 630 bytes | 2023-03-26 14:35:36 |
76601 | jzlb_txy | Coco is coo! | D | Wrong Answer | 2256 KiB | 0 ms | C++ | 682 bytes | 2023-03-26 14:24:21 |
76593 | jzlb_txy | Coco is coo! | D | Wrong Answer | 2256 KiB | 0 ms | C++ | 691 bytes | 2023-03-26 14:18:52 |
76514 | jzlb_txy | Coco is coo! | B | Output Limit Exceed | 2060 KiB | 4 ms | C++ | 272 bytes | 2023-03-25 23:58:04 |
76513 | jzlb_txy | Coco is coo! | B | Output Limit Exceed | 2060 KiB | 0 ms | C++ | 272 bytes | 2023-03-25 23:54:59 |
76512 | jzlb_txy | Coco is coo! | D | Wrong Answer | 2056 KiB | 0 ms | C++ | 259 bytes | 2023-03-25 23:15:57 |
76511 | jzlb_txy | Coco is coo! | D | Wrong Answer | 2052 KiB | 0 ms | C++ | 259 bytes | 2023-03-25 23:08:20 |
76510 | jzlb_txy | Coco is coo! | D | Wrong Answer | 2020 KiB | 0 ms | C++ | 259 bytes | 2023-03-25 23:04:20 |
76509 | jzlb_txy | Coco is coo! | D | Time Limit Exceed | 2024 KiB | 1988 ms | C++ | 215 bytes | 2023-03-25 22:56:12 |
76508 | jzlb_txy | Coco is coo! | D | Wrong Answer | 2020 KiB | 0 ms | C++ | 225 bytes | 2023-03-25 22:33:53 |
76507 | jzlb_txy | Coco is coo! | D | Wrong Answer | 2020 KiB | 0 ms | C++ | 227 bytes | 2023-03-25 22:07:16 |
76506 | jzlb_txy | Coco is coo! | C | Accepted | 5808 KiB | 664 ms | C++ | 291 bytes | 2023-03-25 21:54:45 |
76505 | jzlb_txy | Coco is coo! | C | Wrong Answer | 5808 KiB | 648 ms | C++ | 283 bytes | 2023-03-25 21:50:11 |
76502 | jzlb_txy | Coco is coo! | Time Limit Exceed | 5020 KiB | 2024 ms | C++ | 315 bytes | 2023-03-25 21:23:31 | |
76500 | jzlb_txy | Coco is coo! | D | Time Limit Exceed | 2024 KiB | 2004 ms | C++ | 252 bytes | 2023-03-25 21:16:50 |
76499 | jzlb_txy | Coco is coo! | D | Time Limit Exceed | 2024 KiB | 1992 ms | C++ | 252 bytes | 2023-03-25 21:05:14 |
76494 | jzlb_txy | Coco is coo! | D | Time Limit Exceed | 2024 KiB | 1992 ms | C++ | 252 bytes | 2023-03-25 19:11:15 |
76493 | jzlb_txy | Coco is coo! | C | Time Limit Exceed | 2896 KiB | 2064 ms | C++ | 320 bytes | 2023-03-25 19:08:00 |
76394 | jzlb_txy | Coco is coo! | C | Time Limit Exceed | 2900 KiB | 1996 ms | C++ | 309 bytes | 2023-03-24 22:58:56 |
76393 | jzlb_txy | Coco is coo! | C | Compile Error | 0 KiB | 0 ms | C++ | 315 bytes | 2023-03-24 22:57:36 |
76392 | jzlb_txy | Coco is coo! | C | Compile Error | 0 KiB | 0 ms | C++ | 315 bytes | 2023-03-24 22:56:48 |
76228 | jzlb_txy | Coco is coo! | A | Accepted | 2024 KiB | 0 ms | C++ | 234 bytes | 2023-03-22 22:45:45 |
76227 | jzlb_txy | Coco is coo! | Time Limit Exceed | 5020 KiB | 2004 ms | C++ | 312 bytes | 2023-03-22 22:21:29 | |
76226 | jzlb_txy | Coco is coo! | A | Wrong Answer | 2024 KiB | 0 ms | C++ | 252 bytes | 2023-03-22 22:20:06 |