大佬们我能问问是哪里有问题吗
查看原帖
大佬们我能问问是哪里有问题吗
488809
LIASPO楼主2022/5/6 10:58
#include<iostream>

using namespace std;
int df(int a,int b){
	if(a==b){
		return 2;
	}else	if(a==0&&b==2||a==0&&b==3){
		return 1;
	}else if(a==0&&b==1||a==0&&b==4){
		return 0;
	}else	if(a==1&&b==3){
		return 1;
	}else if(a==1&&b==2||a==1&&b==4){
		return 0;
	}else if(a==1&&b==3){
		return 1;
		}else if(a==2&&b==3){
		 return 0;
		} else if(a==2&&b==4){
			return 1;
		}
		else if(a==3&&b==2){
			return 0;
		}
		else if(a==3&&b==0||a==3&&b==4||a==3&&b==1){
			return 1;
		}
		else if(a==4&&b==5){
			return 1;
		}

       
}

int main(){
    int n,n1,n2,a[1000],b[1000],d1=0,d2=0,g1,g2;
    cin>>n>>n1>>n2;
    for(int i=1;i<=n1;i++){
    	cin>>a[i];
	}
	for(int i=1;i<=n2;i++){
    	cin>>b[i];
	}
	g1=g2=1;
	for(int i=1;i<=n;i++){
	//	cout<<a[g1]<<" "<<b[g2]<<" "<<df(a[g1],b[g2])<<" "<<df(b[g2],a[g1])<<endl;
	    if(df(a[g1],b[g2])==2){
	    	d1+=0;d2+=0;
	    	goto F;
		}else{
		  d1+=df(a[g1],b[g2]);
		  d2=d2+1-df(a[g1],b[g2]);
		}
		F:
		g1++;g2++;
		if(g1>n1){
			g1=1;
		}
		if(g2>n2){
			g2=1;
		}
	}
    cout<<d1<<" "<<d2;
    return 0;
} 
2022/5/6 10:58
加载中...