- 生活大爆炸版 石头剪刀布
- 2016-12-15 00:28:05 @
#include<iostream>
using namespace std;
int main()
{
int n,na,nb;
cin>>n>>na>>nb;
int *temp1=new int[na];
int *temp2=new int[nb];
int *sum1=new int[n];
int *sum2=new int[n];
for(int i=0;i<na;i++)
cin>>temp1[i];
for(int i=0;i<nb;i++)
cin>>temp2[i];
for(int i=0;i<n;i++)
{
sum1[i]=temp1[i%na];
sum2[i]=temp2[i%nb];
}
/*for(int i=0;i<n;i++)
cout<<sum1[i];
cout<<endl;
for(int i=0;i<n;i++)
cout<<sum2[i];
cout<<endl;*/
int grade1=0,grade2=0;
for(int i=0;i<n;i++)
{
if(sum1[i]==0&&(sum2[i]==2||sum2[i]==3||sum2[i]==4))
grade1++;
if(sum1[i]==1&&(sum2[i]==0||sum2[i]==3))
grade1++;
if(sum1[i]==2&&(sum2[i]==1||sum2[i]==4))
grade1++;
if(sum1[i]==3&&(sum2[i]==2||sum2[i]==4))
grade1++;
if(sum1[i]==4&&(sum2[i]==0||sum2[i]==1))
grade1++;
}
for(int i=0;i<n;i++)
{
if(sum2[i]==0&&(sum1[i]==2||sum1[i]==3||sum1[i]==4))
grade2++;
if(sum2[i]==1&&(sum1[i]==0||sum1[i]==3))
grade2++;
if(sum2[i]==2&&(sum1[i]==1||sum1[i]==4))
grade2++;
if(sum2[i]==3&&(sum1[i]==2||sum1[i]==4))
grade2++;
if(sum2[i]==4&&(sum1[i]==0||sum1[i]==1))
grade2++;
}
cout<<grade1<<" "<<grade2;
return 0;
}
1 条评论
-
blabla LV 7 @ 2016-12-15 00:44:02
我真是。。。
- 1