#include<stdio.h>
#include<math.h>
int main()
{
int N,NA,NB;
int a[100],b[100];
int A[100],B[100];
int tempa,tempb;
int counta=0,countb=0;
scanf("%d %d %d",&N,&NA,&NB);
for(int i=0;i<NA;i++)
{
scanf("%d",&a[i]);
}
for(int i=0;i<NB;i++)
{
scanf("%d",&b[i]);
}
for(int i=0;i<N;i++)
{
tempa=i%NA;
A[i]=a[tempa];
tempb=i%NB;
B[i]=b[tempb];
}
for(int i=0;i<N;i++)
{
if(A[i]==0&&B[i]==5){countb++;}
else if(A[i]==5&&B[i]==0){counta++;}
else
{
if(A[i]>B[i])countb++;
else if(A[i]<B[i])counta++;
}
}
if(counta>countb)printf("A");
else if(counta<countb)printf("B");
else printf("draw");
return 0;
}
感觉涉及到了循环队列,之后刷题的时候再接触涉及一下队列的知识,复习循环队列
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:668 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:1099 |
WU-判定字符位置 (C++代码)浏览:1406 |
C语言训练-排序问题<1> (C语言代码)浏览:355 |
简单的a+b (C语言代码)浏览:587 |
核桃的数量 (C语言代码)浏览:829 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:424 |
【回文数(二)】 (C语言代码)浏览:693 |
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)(正序逆序都可以)浏览:864 |
哥德巴赫曾猜测 (C++代码)浏览:740 |