#include <string.h>
int main ()
{
int a, b, c, test, k, n,l, v, max, min, i;
char str[21], s1[21],s2[21];
scanf (" %d", &test);
for (k = 1; k <= test; k++) {
scanf("%d",&n);
scanf ("%s%d%d%d",str,&a,&b,&c);
max=min=a * b * c;
strcpy (s1,str);
strcpy (s2, str);
for (i = 1; i < n; i++) {
scanf ("%s%d%d%d",str,&a,&b,&c);
v = a * b * c;
if (v > max) {
strcpy (s1 , str);
max = v;
}
else if (v < min) {
strcpy (s2 , str);
min = v;
}
}
if (max == min) printf ("Case %d: no thief\n", k);
else printf ("Case %d: %s took chocolate from %s\n", k, s1, s2);
}
return 0;
}
No comments:
Post a Comment