悬赏关注求调!!!
查看原帖
悬赏关注求调!!!
1051749
noi_onlyup楼主2024/8/2 11:26
#include<bits/stdc++.h>
using namespace std;
long long n,p,a,b,c;
bool o[11514][11514];
int ff(long long x,long long y){
	if(x==0){
		o[x][y]=1;
		return 1;
	}
	if(y==0){
		o[x][y]=2;
		return 2;
	}
	if(o[x][y]==-1){
		o[x][y]=3;
		return 3;
	} 
	o[x][y]=-1;
	o[x][y]=ff((x+y)%p,(x+y+y)%p);
} 
int main(){
	cin>>n>>p;
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		c=ff(a,b);
		if(c==1) cout<<1<<"\n";
		if (c==3) cout<<"error"<<"\n";
		if(c==2) cout<<2<<"\n";  
	} 
	return 0;
}

悬赏2个关注,求调,谢谢帮忙的大佬!

2024/8/2 11:26
加载中...