CONTEST ID : 1546 - 3.19递推练习

#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; 
}


SERVER TIME : 2024-11-24 05:33:36
Finished

STATUS : End    OPEN : Public
Start Time : 2023-03-19 12:00:00
End Time : 2023-04-02 16:00:00


Problem ID    User    Language    Result   

RunID User Nick Name Problem ID Result Memory Time Language Code Length Submit Time
76613jzlb_xyx谢宇轩
D
Accepted
2256 KiB
0 ms
C++626 bytes2023-03-26 14:35:36
76571jzlb_xyx谢宇轩
D
Wrong Answer
2060 KiB
0 ms
C++240 bytes2023-03-26 13:34:00
76490jzlb_xyx谢宇轩
D
Wrong Answer
2060 KiB
0 ms
C++242 bytes2023-03-25 16:15:23
76489jzlb_xyx谢宇轩
D
Runtime Error
2024 KiB
0 ms
C++236 bytes2023-03-25 16:14:02
76487jzlb_xyx谢宇轩
D
Wrong Answer
3460 KiB
0 ms
C++238 bytes2023-03-25 16:11:12
76479jzlb_xyx谢宇轩
D
Time Limit Exceed
2024 KiB
2012 ms
C++248 bytes2023-03-25 15:56:27
76477jzlb_xyx谢宇轩
D
Runtime Error
2020 KiB
0 ms
C++265 bytes2023-03-25 15:55:51
76476jzlb_xyx谢宇轩
D
Runtime Error
2020 KiB
0 ms
C++265 bytes2023-03-25 15:55:32
76475jzlb_xyx谢宇轩
D
Wrong Answer
3460 KiB
0 ms
C++272 bytes2023-03-25 15:53:42
76474jzlb_xyx谢宇轩
D
Wrong Answer
3460 KiB
0 ms
C++272 bytes2023-03-25 15:52:52
76469jzlb_xyx谢宇轩
D
Wrong Answer
2020 KiB
0 ms
C++226 bytes2023-03-25 15:39:32
76466jzlb_xyx谢宇轩
D
Wrong Answer
2020 KiB
0 ms
C++232 bytes2023-03-25 15:37:14
76465jzlb_xyx谢宇轩
D
Wrong Answer
2020 KiB
0 ms
C++232 bytes2023-03-25 15:36:55
76462jzlb_xyx谢宇轩
D
Wrong Answer
2020 KiB
0 ms
C++230 bytes2023-03-25 15:31:49
76461jzlb_xyx谢宇轩Wrong Answer
2804 KiB
0 ms
C++431 bytes2023-03-25 15:27:39
76457jzlb_xyx谢宇轩
B
Time Limit Exceed
33932 KiB
2004 ms
C++401 bytes2023-03-25 15:21:37
76456jzlb_xyx谢宇轩
B
Wrong Answer
2024 KiB
4 ms
C++260 bytes2023-03-25 15:20:28
76455jzlb_xyx谢宇轩
G
Accepted
2024 KiB
0 ms
C++277 bytes2023-03-25 15:17:59
76452jzlb_xyx谢宇轩
D
Wrong Answer
2020 KiB
0 ms
C++230 bytes2023-03-25 14:54:04
76451jzlb_xyx谢宇轩
D
Wrong Answer
2020 KiB
0 ms
C++230 bytes2023-03-25 14:53:28
76447jzlb_xyx谢宇轩
D
Runtime Error
2020 KiB
0 ms
C++224 bytes2023-03-25 14:46:23
76446jzlb_xyx谢宇轩
D
Runtime Error
2020 KiB
0 ms
C++224 bytes2023-03-25 14:45:30
76444jzlb_xyx谢宇轩
D
Wrong Answer
2020 KiB
0 ms
C++226 bytes2023-03-25 14:44:18
76443jzlb_xyx谢宇轩
B
Time Limit Exceed
33932 KiB
2016 ms
C++401 bytes2023-03-25 14:36:31
76442jzlb_xyx谢宇轩
B
Time Limit Exceed
33932 KiB
2004 ms
C++401 bytes2023-03-25 14:34:19
76415jzlb_xyx谢宇轩
B
Time Limit Exceed
33932 KiB
2012 ms
C++324 bytes2023-03-25 13:11:19
76207jzlb_xyx谢宇轩
B
Time Limit Exceed
33192 KiB
2000 ms
C++317 bytes2023-03-22 21:04:45
76206jzlb_xyx谢宇轩
B
Time Limit Exceed
33192 KiB
1992 ms
C++317 bytes2023-03-22 20:49:50
76205jzlb_xyx谢宇轩
B
Time Limit Exceed
33188 KiB
1996 ms
C++317 bytes2023-03-22 20:47:32
76202jzlb_xyx谢宇轩
A
Accepted
2024 KiB
0 ms
C++248 bytes2023-03-22 19:42:40
76200jzlb_xyx谢宇轩Accepted
2804 KiB
0 ms
C++431 bytes2023-03-22 19:37:07