- 生活大爆炸版 石头剪刀布
- 2016-09-12 20:07:11 @
#include<stdio.h>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
int n,na,nb;
cin>>n>>na>>nb;
int a[200+5],b[200+5];
for(int i=1;i<=na;i++)
{
cin>>a[i];
}
for(int i=1;i<=nb;i++)
{
cin>>b[i];
}
int sa=0,sb=0,z=1,x=1;
for(int i=1;i<=n;i++)
{
if(a[z]==0&&b[x]==0){z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==0&&b[x]==1){sb++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==0&&b[x]==2){sa++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==0&&b[x]==3){sa++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==0&&b[x]==4){sb++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==1&&b[x]==0){sa++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==1&&b[x]==1){z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==1&&b[x]==2){sb++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==1&&b[x]==3){sa++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==1&&b[x]==4){sb++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==2&&b[x]==0){sb++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==2&&b[x]==1){sa++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==2&&b[x]==2){z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==2&&b[x]==3){sb++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==2&&b[x]==4){sa++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==3&&b[x]==0){sb++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==3&&b[x]==1){sb++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==3&&b[x]==2){sa++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==3&&b[x]==3){z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==3&&b[x]==4){sa++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==4&&b[x]==0){sa++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==4&&b[x]==1){sa++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==4&&b[x]==2){sb++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==4&&b[x]==3){sb++;z++;x++;if(z==na)z=1;if(x==nb)x=1;}
else if(a[z]==4&&b[x]==4){z++;x++;if(z==na)z=1;if(x==nb)x=1;}
}
cout<<sa<<' '<<sb;
return 0 ;
}
1 条评论
-
lrj124 LV 10 @ 2016-09-18 13:33:24
错误已用*标出
c++
#include<stdio.h>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
int n,na,nb;
cin>>n>>na>>nb;
int a[200+5],b[200+5];
for(int i=1;i<=na;i++)
{
cin>>a[i];
}
for(int i=1;i<=nb;i++)
{
cin>>b[i];
}
int sa=0,sb=0,z=1,x=1;
for(int i=1;i<=n;i++)
{
if(a[z]==0&&b[x]==0){z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==0&&b[x]==1){sb++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==0&&b[x]==2){sa++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==0&&b[x]==3){sa++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==0&&b[x]==4){sb++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==1&&b[x]==0){sa++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==1&&b[x]==1){z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==1&&b[x]==2){sb++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==1&&b[x]==3){sa++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==1&&b[x]==4){sb++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==2&&b[x]==0){sb++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==2&&b[x]==1){sa++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==2&&b[x]==2){z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==2&&b[x]==3){sb++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==2&&b[x]==4){sa++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==3&&b[x]==0){sb++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==3&&b[x]==1){sb++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==3&&b[x]==2){sa++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==3&&b[x]==3){z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==3&&b[x]==4){sa++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==4&&b[x]==0){sa++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==4&&b[x]==1){sa++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==4&&b[x]==2){sb++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==4&&b[x]==3){sb++;z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
else if(a[z]==4&&b[x]==4){z++;x++;if(z==na*+1*)z=1;if(x==nb*+1*)x=1;}
}
cout<<sa<<' '<<sb;
return 0 ;
}
- 1