#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 |
76074 | jzlb_gcx | 顾辰曦 | Wrong Answer | 2684 KiB | 0 ms | C++ | 393 bytes | 2023-03-21 21:41:22 | |
76073 | jzlb_gcx | 顾辰曦 | B | Wrong Answer | 9792 KiB | 8 ms | C++ | 417 bytes | 2023-03-21 21:37:30 |
76067 | jzlb_gcx | 顾辰曦 | B | Wrong Answer | 9796 KiB | 8 ms | C++ | 419 bytes | 2023-03-21 21:28:40 |
76066 | jzlb_gcx | 顾辰曦 | B | Wrong Answer | 9716 KiB | 8 ms | C++ | 417 bytes | 2023-03-21 21:27:33 |
76065 | jzlb_gcx | 顾辰曦 | B | Runtime Error | 2024 KiB | 0 ms | C++ | 415 bytes | 2023-03-21 21:26:17 |
76064 | jzlb_gcx | 顾辰曦 | B | Runtime Error | 2024 KiB | 0 ms | C++ | 407 bytes | 2023-03-21 21:23:20 |
76059 | jzlb_gcx | 顾辰曦 | B | Runtime Error | 2024 KiB | 0 ms | C++ | 320 bytes | 2023-03-21 21:12:18 |
76057 | jzlb_gcx | 顾辰曦 | A | Accepted | 2020 KiB | 0 ms | C++ | 204 bytes | 2023-03-21 21:05:40 |
75898 | jzlb_lxb | 罗刹怒海 | B | Runtime Error | 2024 KiB | 0 ms | C++ | 251 bytes | 2023-03-20 21:18:01 |
75882 | jzlb_lxb | 罗刹怒海 | B | Runtime Error | 2024 KiB | 0 ms | C++ | 259 bytes | 2023-03-20 20:38:39 |
75869 | jzlb_trz | 诗剑行 | Accepted | 9836 KiB | 0 ms | C++ | 369 bytes | 2023-03-20 18:53:28 | |
75868 | jzlb_lxb | 罗刹怒海 | A | Accepted | 2020 KiB | 0 ms | C++ | 185 bytes | 2023-03-20 18:52:06 |
75867 | jzlb_lxb | 罗刹怒海 | A | Wrong Answer | 2020 KiB | 0 ms | C++ | 172 bytes | 2023-03-20 18:49:35 |
75866 | jzlb_trz | 诗剑行 | D | Wrong Answer | 2020 KiB | 0 ms | C++ | 313 bytes | 2023-03-20 18:41:56 |
75864 | jzlb_trz | 诗剑行 | D | Wrong Answer | 2020 KiB | 0 ms | C++ | 289 bytes | 2023-03-20 18:27:50 |
75863 | jzlb_trz | 诗剑行 | D | Wrong Answer | 2020 KiB | 0 ms | C++ | 289 bytes | 2023-03-20 18:27:31 |
75862 | jzlb_trz | 诗剑行 | D | Wrong Answer | 2020 KiB | 0 ms | C++ | 283 bytes | 2023-03-20 18:26:20 |
75861 | jzlb_trz | 诗剑行 | C | Accepted | 9836 KiB | 576 ms | C++ | 422 bytes | 2023-03-20 18:18:19 |
75860 | jzlb_trz | 诗剑行 | C | Wrong Answer | 5968 KiB | 656 ms | C++ | 430 bytes | 2023-03-20 18:14:56 |
75859 | jzlb_trz | 诗剑行 | C | Wrong Answer | 5968 KiB | 632 ms | C++ | 430 bytes | 2023-03-20 18:11:57 |
75856 | jzlb_trz | 诗剑行 | B | Accepted | 6320 KiB | 4 ms | C++ | 425 bytes | 2023-03-20 17:42:43 |
75740 | jzlb_trz | 诗剑行 | A | Accepted | 2020 KiB | 0 ms | C++ | 312 bytes | 2023-03-20 09:08:42 |
75723 | jzlb_chengyixuan | 程意轩 | B | Runtime Error | 2760 KiB | 0 ms | C++ | 281 bytes | 2023-03-19 21:17:43 |
75721 | jzlb_chengyixuan | 程意轩 | B | Runtime Error | 2764 KiB | 0 ms | C++ | 278 bytes | 2023-03-19 21:15:19 |
75720 | jzlb_chengyixuan | 程意轩 | B | Runtime Error | 2764 KiB | 0 ms | C++ | 276 bytes | 2023-03-19 21:14:24 |
75716 | jzlb_chengyixuan | 程意轩 | B | Runtime Error | 2764 KiB | 0 ms | C++ | 289 bytes | 2023-03-19 21:10:46 |
75715 | jzlb_chengyixuan | 程意轩 | B | Runtime Error | 2332 KiB | 0 ms | C++ | 283 bytes | 2023-03-19 21:09:18 |
75714 | jzlb_chengyixuan | 程意轩 | B | Runtime Error | 2024 KiB | 0 ms | C++ | 276 bytes | 2023-03-19 21:07:36 |
75712 | jzlb_chengyixuan | 程意轩 | B | Runtime Error | 2024 KiB | 0 ms | C++ | 276 bytes | 2023-03-19 21:06:00 |
75711 | jzlb_chengyixuan | 程意轩 | B | Runtime Error | 2024 KiB | 0 ms | C++ | 276 bytes | 2023-03-19 21:05:18 |
75704 | jzlb_chengyixuan | 程意轩 | A | Accepted | 2020 KiB | 0 ms | C++ | 191 bytes | 2023-03-19 20:08:21 |