SUMTRIAN WA

Please somebody help with this question
i am getting wrong answer

Link to Question -

My Solution –
http://www.codechef.com/viewsolution/5208061

i think there is problem with the function in().a correct implementation would be

int get_int(){
int t=0;char c=getchar();
while(c<‘0’||c>‘9’)c=getchar();
while(c>=‘0’&&c<=‘9’){
t=(t<<3)+(t<<1)+c-‘0’;
c=getchar();
}
return t;
}

1 Like

in() function is working fine
i have used it many question
the problem is in the main function
i am not able to figure out the why its always giving a WA as its showing correct output in many test cases on my laptop
but here it is giving WA