Why I'm getting WA with this code on The Lead Game problem ????

#include <stdio.h>
#include <math.h>
int main(void) {
int n,i=0,max,winner;
int S[n],T[n],R[n],L[n];
scanf("%d",&S*); scanf("%d",&T*);
L* = abs(S*-T*);
if (S*>T*)
max = L[0];
winner = R[0];
for (i=1;i<n;++i){
if (L*>max)
max = L*;
winner = R*;
printf("%d %d",winner,max);
return 0;

http://www.codechef.com/viewsolution/6764394 TAKE A LOOK AT MY SOLUTION

OK I need the karma.
Here is an accepted version of your code,

There are three primary errors which I will point out.

int S[n],T[n]

You don’t need to store the values why use array.

Simply replace this with

int S,T;

**scanf("%d",&S*); scanf("%d",&T*);**
The scores are cumulative, read the question again. Score of the previous round questions get carried forward. Replace this with,

int a,b;
scanf("%d",&a); scanf("%d",&b);

You are reducing the value of n here to 0, how do you expect the next for loop to work,
for (i=1;i<**n**;++i)

**if (L*>max)
max = L*;
winner = R*;

You missed a bracket here. Without it winner is always getting set to the R[n-1]

if (L>max){

max = L

winner = R*;

Hope this helps.

So, where is the fault of my code ??? I don’t see any of it. Just a different way to solve the problem

Refer to this: http://discuss.codechef.com/questions/68537/lead-game-can-someone-give-other-test-cases-so-i-can-find-out-whats-wrong?page=1#68540