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 07:48:33
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
77539jzlb_cxr_dsx小*最*
B
Accepted
9716 KiB
8 ms
C++418 bytes2023-04-01 15:29:14
77533jzlb_cxr_dsx小*最*
B
Runtime Error
2024 KiB
0 ms
C++408 bytes2023-04-01 13:47:31
77532jzlb_cxr_dsx小*最*
B
Runtime Error
2024 KiB
0 ms
C++408 bytes2023-04-01 13:36:50
77303jzlb_cxr_dsx小*最*
G
Accepted
2024 KiB
0 ms
C++315 bytes2023-03-29 18:17:16
77302jzlb_cxr_dsx小*最*Accepted
2292 KiB
0 ms
C++248 bytes2023-03-29 17:52:10
77301jzlb_cxr_dsx小*最*Wrong Answer
2292 KiB
0 ms
C++248 bytes2023-03-29 17:50:03
77298jzlb_cxr_dsx小*最*Accepted
2292 KiB
0 ms
C++268 bytes2023-03-29 17:30:48
77292jzlb_cxr_dsx小*最*
C
Accepted
5808 KiB
724 ms
C++284 bytes2023-03-29 17:26:11
77268jzlb_cxr_dsx小*最*
A
Accepted
2020 KiB
0 ms
C++209 bytes2023-03-29 17:09:28
77256jzlb_gzj耿老师
A
Accepted
2020 KiB
0 ms
C++198 bytes2023-03-29 17:05:23
76618jzlb_gcx顾辰曦
D
Accepted
2256 KiB
0 ms
C++626 bytes2023-03-26 14:37:56
76617jzlb_txyCoco is coo!
D
Accepted
2256 KiB
0 ms
C++616 bytes2023-03-26 14:37:09
76616jzlb_gcx顾辰曦
D
Wrong Answer
2024 KiB
0 ms
C++789 bytes2023-03-26 14:36:34
76615jzlb_trz诗剑行
D
Accepted
2256 KiB
0 ms
C++626 bytes2023-03-26 14:36:04
76614jzlb_chengyixuan程意轩
D
Accepted
2256 KiB
0 ms
C++628 bytes2023-03-26 14:36:00
76613jzlb_xyx谢宇轩
D
Accepted
2256 KiB
0 ms
C++626 bytes2023-03-26 14:35:36
76612jzlb_txyCoco is coo!
D
Accepted
2256 KiB
0 ms
C++630 bytes2023-03-26 14:35:36
76611jzlb_cxr_dsx小*最*
D
Accepted
2256 KiB
0 ms
C++628 bytes2023-03-26 14:35:20
76610jzlb_lxb罗刹怒海
D
Accepted
2256 KiB
0 ms
C++626 bytes2023-03-26 14:35:07
76601jzlb_txyCoco is coo!
D
Wrong Answer
2256 KiB
0 ms
C++682 bytes2023-03-26 14:24:21
76598jzlb_gzj耿老师
D
Accepted
2256 KiB
0 ms
C++677 bytes2023-03-26 14:23:23
76596jzlb_trz诗剑行
A
Accepted
2020 KiB
0 ms
C++312 bytes2023-03-26 14:19:51
76595jzlb_gzj耿老师
D
Wrong Answer
2256 KiB
0 ms
C++665 bytes2023-03-26 14:19:48
76594jzlb_gcx顾辰曦
D
Wrong Answer
2060 KiB
0 ms
C++319 bytes2023-03-26 14:19:02
76593jzlb_txyCoco is coo!
D
Wrong Answer
2256 KiB
0 ms
C++691 bytes2023-03-26 14:18:52
76584jzlb_chengyixuan程意轩
D
Wrong Answer
2176 KiB
0 ms
C++217 bytes2023-03-26 14:01:21
76575jzlb_chengyixuan程意轩
D
Wrong Answer
2176 KiB
0 ms
C++217 bytes2023-03-26 13:43:38
76573jzlb_chengyixuan程意轩
D
Wrong Answer
2176 KiB
0 ms
C++217 bytes2023-03-26 13:41:20
76571jzlb_xyx谢宇轩
D
Wrong Answer
2060 KiB
0 ms
C++240 bytes2023-03-26 13:34:00
76570jzlb_chengyixuan程意轩
D
Wrong Answer
2056 KiB
0 ms
C++222 bytes2023-03-26 13:33:37
76558jzlb_chengyixuan程意轩
C
Accepted
9836 KiB
640 ms
C++264 bytes2023-03-26 13:13:28
76554jzlb_chengyixuan程意轩
C
Runtime Error
9912 KiB
88 ms
C++290 bytes2023-03-26 13:07:05
76552jzlb_chengyixuan程意轩
C
Wrong Answer
9912 KiB
560 ms
C++292 bytes2023-03-26 13:05:39
76551jzlb_chengyixuan程意轩
C
Wrong Answer
9912 KiB
628 ms
C++306 bytes2023-03-26 13:03:29
76550jzlb_chengyixuan程意轩
C
Runtime Error
9912 KiB
92 ms
C++321 bytes2023-03-26 12:51:05
76514jzlb_txyCoco is coo!
B
Output Limit Exceed
2060 KiB
4 ms
C++272 bytes2023-03-25 23:58:04
76513jzlb_txyCoco is coo!
B
Output Limit Exceed
2060 KiB
0 ms
C++272 bytes2023-03-25 23:54:59
76512jzlb_txyCoco is coo!
D
Wrong Answer
2056 KiB
0 ms
C++259 bytes2023-03-25 23:15:57
76511jzlb_txyCoco is coo!
D
Wrong Answer
2052 KiB
0 ms
C++259 bytes2023-03-25 23:08:20
76510jzlb_txyCoco is coo!
D
Wrong Answer
2020 KiB
0 ms
C++259 bytes2023-03-25 23:04:20
76509jzlb_txyCoco is coo!
D
Time Limit Exceed
2024 KiB
1988 ms
C++215 bytes2023-03-25 22:56:12
76508jzlb_txyCoco is coo!
D
Wrong Answer
2020 KiB
0 ms
C++225 bytes2023-03-25 22:33:53
76507jzlb_txyCoco is coo!
D
Wrong Answer
2020 KiB
0 ms
C++227 bytes2023-03-25 22:07:16
76506jzlb_txyCoco is coo!
C
Accepted
5808 KiB
664 ms
C++291 bytes2023-03-25 21:54:45
76505jzlb_txyCoco is coo!
C
Wrong Answer
5808 KiB
648 ms
C++283 bytes2023-03-25 21:50:11
76504jzlb_gzj耿老师
C
Accepted
5808 KiB
688 ms
C++255 bytes2023-03-25 21:36:46
76503jzlb_gzj耿老师
C
Runtime Error
5808 KiB
4 ms
C++255 bytes2023-03-25 21:34:18
76502jzlb_txyCoco is coo!Time Limit Exceed
5020 KiB
2024 ms
C++315 bytes2023-03-25 21:23:31
76500jzlb_txyCoco is coo!
D
Time Limit Exceed
2024 KiB
2004 ms
C++252 bytes2023-03-25 21:16:50
76499jzlb_txyCoco is coo!
D
Time Limit Exceed
2024 KiB
1992 ms
C++252 bytes2023-03-25 21:05:14