6分救
查看原帖
6分救
1021693
lzy13915136909楼主2024/5/25 17:22

code

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,p,t=2,a=1,b=1;
	cin>>n>>p;
	for(int i=3;i<=n;i++)
	{
		t=t+a+b;
		b=a;
		a=t;
	}
	cout<<t<<" "<<t%p;
	return 0;
}
2024/5/25 17:22
加载中...