文章

59

粉丝

0

获赞

201

访问

4.4k

头像
不连续1的子串 题解:long long
P1726 中山大学机试题
发布于2026年3月13日 15:21
阅读数 57

#include <iostream>
#include <string>
#include <cstring>
using namespace std;

int main()
{
	int N;
	cin>>N;
	long long total[21]={1};
	total[1]=2;
	total[2]=3;
	int x=2;
	if(N>2)
		while(x++!=N)
			total[x]=total[x-1]+total[x-2];
	cout<<total[N]<<endl;
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发