- 生活大爆炸版 石头剪刀布
- 2017-10-25 19:54:51 @
#include<iostream>
using namespace std;
int rel[5][5]={
{0,0,1,1,0},
{1,0,0,1,0},
{0,1,0,0,1},
{0,0,1,0,1},
{1,1,0,0,0},
};
int w1[103];
int w2[103];
int top1;
int top2;
int m1;
int m2;
int ans1;
int ans2;
int main(){
int n;
cin>>n;
cin>>m1;
cin>>m2;
top1=0;
top2=0;
while(top1!=m1){
cin>>w1[top1];
top1++;
}
top1=0;
while(top2!=m2){
cin>>w2[top2];
top2++;
}
top2=0;
for(int i=1;i<=n;i++){
if(top1==m1)
top1=0;
if(top2==m2)
top2=0;
ans1+=rel[w1[top1]][w2[top2]];
ans2+=rel[w2[top2]][w1[top1]];
top1++;
top2++;
//cout<<i<<" . "<<w2[top2]<<" ---> "<<w1[top1]<<" = "<<rel[w2[top2]][w1[top1]]<<endl;
}
cout<<ans1<<" "<<ans2;
}