Hello,
can anybody point out to me what I am doing wrong? I read the assignment carefully (as suggested many times ), I compared my output to other successful submissions and got the same results but still my submission is not accepted.
#include <stdio.h>
#include <stdlib.h>
int main(void) {
unsigned short N;
scanf("%hu", &N);
unsigned short score1, score2;
// negative value = player2 is leading
// positive value = player1 is leading
int lead, biggest;
unsigned int total1=0, total2=0;
while(N-- > 0) {
scanf("%hu %hu", &score1, &score2);
total1 += score1;
total2 += score2;
lead = total1 - total2;
if(abs(lead) >= abs(biggest)) {
biggest = lead;
}
}
// output
if(biggest < 0) {
printf("2 %d\n", abs(biggest));
} else {
printf("1 %d\n", abs(biggest));
}
return 0;
}
Thanks!