- #include<cstdlib>
- #include<iostream>
- #include <algorithm>
- using namespace std;
- int main( )
- {
- int n,a,b,numa[105],numb[105];
- cin>>n>>a>>b;
- int A=0,B=0;
- for(int i=0;i<a;i++)
- cin>>numa[i];
- for(int i=0;i<b;i++)
- cin>>numb[i];
- for(int i=0;i<n;i++)
- {
- if((numa[i%a]==0 && numb[i%b]==2)||(numa[i%a]==5 && numb[i%b]==0)||(numa[i%a]==2 && numb[i%b]==5))
- A++;
- else if((numb[i%b]==0 && numa[i%a]==2)||(numb[i%b]==5 && numa[i%a]==0)||( numb[i%b]==2 && numa[i%a]==5 ))
- B++;
- }
- if(A>B)
- cout<<"A"<<endl;
- else if(A<B)
- cout<<"B"<<endl;
- else
- cout<<"draw";
- system("pause") ;
- return 0;
- }
複製代碼 |