解题思路:
注意事项:
参考代码:
#include<stdio.h>
int main()
{
int n, m, d, q = 0, ar[100] = { 0 };
char arr[100][33] = { 0 }, aa[33] = { 0 };
scanf("%d", &n);
getchar();
for (int i = 0; i < n; i++)
gets(arr[i]);
scanf("%d", &m);
while (m--)
{
for (int i = 0; i < n; i++)
{
scanf("%d", &d);
getchar();
gets(aa);
if (strcmp(aa, arr[0]) == 0)
{
q += d;
}
for (int j = 0; j < n; j++)
{
if (strcmp(aa, arr[j]) == 0)
{
ar[j] += d;
}
}
}
int w = 1;
for (int i = 0; i < n; i++)
{
if (ar[i] > q)
w++;
}
printf("%d\n", w);
}
return 0;
}
0.0分
0 人评分