55 lines
1023 B
C++
55 lines
1023 B
C++
#include <iostream>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
int n,longa,longb;
|
|
int a[101]={0},b[101]={0};
|
|
cin>>n>>longa>>longb;
|
|
for(int i=1;i<=longa;i++){
|
|
cin>>a[i];
|
|
}
|
|
for(int i=1;i<=longb;i++){
|
|
cin>>b[i];
|
|
}
|
|
int nowa=0,nowb=0;
|
|
int ans=0;
|
|
for(int i=1;i<=n;i++){
|
|
nowa++;
|
|
nowb++;
|
|
if(nowa>longa){
|
|
nowa=1;
|
|
}
|
|
if(nowb>longb){
|
|
nowb=1;
|
|
}
|
|
int yi=a[nowa],er=b[nowb];
|
|
if(yi==0&&er==2){
|
|
ans++;
|
|
}
|
|
if(yi==2&&er==5){
|
|
ans++;
|
|
}
|
|
if(yi==5&&er==0){
|
|
ans++;
|
|
}
|
|
if(er==0&&yi==2){
|
|
ans--;
|
|
}
|
|
if(er==2&&yi==5){
|
|
ans--;
|
|
}
|
|
if(er==5&&yi==0){
|
|
ans--;
|
|
}
|
|
}
|
|
if(ans==0){
|
|
cout<<"draw";
|
|
}else{
|
|
if(ans>0){
|
|
cout<<"A";
|
|
}else{
|
|
cout<<"B";
|
|
}
|
|
}
|
|
}
|