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-25 04:36:14
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
76305jzlb_gcx顾辰曦
G
Wrong Answer
2024 KiB
0 ms
C++331 bytes2023-03-23 20:44:09
76296jzlb_gcx顾辰曦
G
Wrong Answer
2024 KiB
0 ms
C++333 bytes2023-03-23 20:22:50
76291jzlb_gcx顾辰曦
G
Wrong Answer
2024 KiB
0 ms
C++337 bytes2023-03-23 19:56:25
76289jzlb_gcx顾辰曦
G
Runtime Error
2028 KiB
0 ms
C++519 bytes2023-03-23 19:31:55
76288jzlb_lxb罗刹怒海
D
Wrong Answer
2256 KiB
0 ms
C++297 bytes2023-03-23 19:31:18
76287jzlb_gcx顾辰曦
G
Runtime Error
2028 KiB
0 ms
C++519 bytes2023-03-23 19:29:08
76286jzlb_gcx顾辰曦
G
Runtime Error
2028 KiB
0 ms
C++401 bytes2023-03-23 19:24:52
76280jzlb_gcx顾辰曦
G
Runtime Error
2028 KiB
0 ms
C++262 bytes2023-03-23 18:27:51
76279jzlb_gcx顾辰曦
G
Runtime Error
2028 KiB
0 ms
C++262 bytes2023-03-23 18:25:51
76228jzlb_txyCoco is coo!
A
Accepted
2024 KiB
0 ms
C++234 bytes2023-03-22 22:45:45
76227jzlb_txyCoco is coo!Time Limit Exceed
5020 KiB
2004 ms
C++312 bytes2023-03-22 22:21:29
76226jzlb_txyCoco is coo!
A
Wrong Answer
2024 KiB
0 ms
C++252 bytes2023-03-22 22:20:06
76224jzlb_gcx顾辰曦
C
Accepted
10496 KiB
592 ms
C++319 bytes2023-03-22 21:45:10
76218jzlb_gcx顾辰曦
C
Time Limit Exceed
10496 KiB
2084 ms
C++487 bytes2023-03-22 21:36:09
76214jzlb_gcx顾辰曦
B
Accepted
9716 KiB
8 ms
C++415 bytes2023-03-22 21:30:13
76213jzlb_gcx顾辰曦
B
Runtime Error
2684 KiB
0 ms
C++414 bytes2023-03-22 21:29:29
76212jzlb_gcx顾辰曦
B
Wrong Answer
9796 KiB
0 ms
C++362 bytes2023-03-22 21:22:48
76211jzlb_gcx顾辰曦Accepted
2684 KiB
0 ms
C++289 bytes2023-03-22 21:15:47
76210jzlb_gcx顾辰曦Accepted
2684 KiB
0 ms
C++450 bytes2023-03-22 21:14:32
76209jzlb_gcx顾辰曦Wrong Answer
2684 KiB
0 ms
C++287 bytes2023-03-22 21:06:42
76208jzlb_gcx顾辰曦Wrong Answer
2684 KiB
0 ms
C++280 bytes2023-03-22 21:05:32
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
76201jzlb_lxb罗刹怒海
D
Runtime Error
2020 KiB
0 ms
C++198 bytes2023-03-22 19:39:56
76200jzlb_xyx谢宇轩Accepted
2804 KiB
0 ms
C++431 bytes2023-03-22 19:37:07
76199jzlb_lxb罗刹怒海
C
Accepted
5928 KiB
648 ms
C++551 bytes2023-03-22 19:28:58
76198jzlb_lxb罗刹怒海
C
Time Limit Exceed
2904 KiB
1996 ms
C++289 bytes2023-03-22 19:26:23
76079jzlb_gcx顾辰曦
D
Wrong Answer
2060 KiB
0 ms
C++319 bytes2023-03-21 22:16:54
76077jzlb_gcx顾辰曦Wrong Answer
2684 KiB
0 ms
C++448 bytes2023-03-21 21:48:50
76076jzlb_gcx顾辰曦Wrong Answer
2684 KiB
0 ms
C++448 bytes2023-03-21 21:45:11
76075jzlb_gcx顾辰曦Wrong Answer
2684 KiB
0 ms
C++393 bytes2023-03-21 21:42:14
76074jzlb_gcx顾辰曦Wrong Answer
2684 KiB
0 ms
C++393 bytes2023-03-21 21:41:22
76073jzlb_gcx顾辰曦
B
Wrong Answer
9792 KiB
8 ms
C++417 bytes2023-03-21 21:37:30
76067jzlb_gcx顾辰曦
B
Wrong Answer
9796 KiB
8 ms
C++419 bytes2023-03-21 21:28:40
76066jzlb_gcx顾辰曦
B
Wrong Answer
9716 KiB
8 ms
C++417 bytes2023-03-21 21:27:33
76065jzlb_gcx顾辰曦
B
Runtime Error
2024 KiB
0 ms
C++415 bytes2023-03-21 21:26:17
76064jzlb_gcx顾辰曦
B
Runtime Error
2024 KiB
0 ms
C++407 bytes2023-03-21 21:23:20
76059jzlb_gcx顾辰曦
B
Runtime Error
2024 KiB
0 ms
C++320 bytes2023-03-21 21:12:18
76057jzlb_gcx顾辰曦
A
Accepted
2020 KiB
0 ms
C++204 bytes2023-03-21 21:05:40
75898jzlb_lxb罗刹怒海
B
Runtime Error
2024 KiB
0 ms
C++251 bytes2023-03-20 21:18:01
75882jzlb_lxb罗刹怒海
B
Runtime Error
2024 KiB
0 ms
C++259 bytes2023-03-20 20:38:39
75869jzlb_trz诗剑行Accepted
9836 KiB
0 ms
C++369 bytes2023-03-20 18:53:28
75868jzlb_lxb罗刹怒海
A
Accepted
2020 KiB
0 ms
C++185 bytes2023-03-20 18:52:06
75867jzlb_lxb罗刹怒海
A
Wrong Answer
2020 KiB
0 ms
C++172 bytes2023-03-20 18:49:35
75866jzlb_trz诗剑行
D
Wrong Answer
2020 KiB
0 ms
C++313 bytes2023-03-20 18:41:56
75864jzlb_trz诗剑行
D
Wrong Answer
2020 KiB
0 ms
C++289 bytes2023-03-20 18:27:50
75863jzlb_trz诗剑行
D
Wrong Answer
2020 KiB
0 ms
C++289 bytes2023-03-20 18:27:31
75862jzlb_trz诗剑行
D
Wrong Answer
2020 KiB
0 ms
C++283 bytes2023-03-20 18:26:20