救救蒟蒻(60分)
查看原帖
救救蒟蒻(60分)
938658
v11v11blabla楼主2023/12/23 16:08
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+7;
int a[maxn],b[maxn],c[maxn];
int la = 1,lb = 1,lc = 1;
void add(){
	int jw = 0;
	for(int i = 1;i <= lb;i++){
		c[i] = a[i]+b[i]+jw;
		jw = c[i]/10;
		c[i]%=10;
		a[i] = b[i];
		b[i] = c[i];
	}
	if(jw > 0){
		lc++;
		c[lc] = jw;
		b[lc] = c[lc];
	}
	la = lb;
	lb = lc;
}
int main(){
	int n,m;
	cin >> m >> n;
	if(n == 1){
		cout << 1;
		return 0;
	}else if(n == 2){
		cout << 2;
		return 0;
	}
	a[1] = 1;
	b[1] = 1;
	for(int i = 3;i <= n;i++){
		add();
	}
	for(int i = lc;i > 0;i--){
		cout << c[i];
	}
	return 0;
}

大佬赐福,救救蒟蒻qwq

2023/12/23 16:08
加载中...