Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

The Lead Game- Wrong Answer is coming again and again

$
0
0

include<stdio.h>

include<stdlib.h>

int main() { int i, x, y, n, max = 0, w, sumx=0, sumy=0 ; scanf("%d", &n);

for (i = 0; i < n; i++)
{
    scanf("%d%d", &x, &y);
    sumx += x;
    sumy += y;

    if (abs(sumx-sumy)>abs(max))
        max = sumx-sumy;
}
if (max > 0)
    w = 1;
else
    w = 2;
printf("%d%d\n", w, abs(max));
return 0;

}


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>