解题思路:
注意事项:
参考代码:
#define _CRT_SECURE_NO_WARNINGS
#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]);//小a出拳顺序
}
for (int i=0; i < NB; i++)
{
scanf("%d", &b[i]);//小b出拳顺序
}
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分
1 人评分