不开o2全RE,开了就全AC
查看原帖
不开o2全RE,开了就全AC
867681
23_VS_24楼主2023/8/24 10:37
#include<bits/stdc++.h>
using namespace std;
int ans1=0,ans2=0;
void mag(int a,int b)
{
	if(a==b)
	{
		return ;
	}
	if((a==0&&(b==1||b==4))||(a==1&&(b==2||b==4))||(a==2&&(b==0||b==3))||(a==3&&(b==0||b==1))||(a==4&&(b==2||b==3))){
		ans2++;
		return ;
	}
	else{
		ans1++;
		return ;
	}
}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	int k1=1,k2=1;
	int n;//猜拳次数
	int n1,n2;//分别代表小A和小B的周期长度
	int*num1=new int[n1+5];//小A出拳规律
	int *num2=new int[n2+5]; //小B出拳规律
	cin>>n>>n1>>n2;
	for(int i=1;i<=n1;i++){
		cin>>num1[i];
	}
	for(int j=1;j<=n2;j++){
		cin>>num2[j];
	}
	for(int k=1;k<=n;k++){
		if(k1>n1) k1=1;
		if(k2>n2) k2=1;
		mag(num1[k1],num2[k2]);
		k1++;
		k2++;
	}
	cout<<ans1<<' '<<ans2;
###### 		有没有神犇知道为什么
	
	
	
	
	
	
	
	
	
	
	
	
	delete[] num1;
	delete[] num2;
	return 0;
}
2023/8/24 10:37
加载中...