psq15016267011 @ 2024-11-29 16:59:24
无法输出,求改!!!!!!!HELP!!!!!!!!!
#include <bits/stdc++.h>
using namespace std;
const int N=5010;
struct BI{
int d[N];
int len;
void print(){
for(int i=len-1;i>=0;i--) cout<<d[i];
}
};
BI operator + (const BI& x,const BI& y){
BI z;
int jin=0,len;
len=max(x.len,y.len);
for(int i=0;i<len;i++){
z.d[i]=x.d[i]+y.d[i]+jin;
jin=z.d[i]/10;
z.d[i]%=10;
}
if(jin) z.d[len++]=jin;
z.len=len;
return z;
}
BI a[5010];
int main(){
int n;
cin >> n;
a[1].d[0]=1;
a[1].len = 1;
a[2].d[0]=2;
a[2].len = 1;
for(int i=3;i<=n;i+1) {
a[i]=a[i-1]+a[i-2];
}
a[n].print();
return 0;
}
by _czx6666_ @ 2024-11-29 17:12:45
i+1 改i++
by _czx6666_ @ 2024-11-29 17:13:12
@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011@psq15016267011
by psq15016267011 @ 2024-11-29 17:22:19
@czx6666大佬怎么改?
by psq15016267011 @ 2024-11-29 17:24:40
@czx6666过了,谢谢大佬!!!