Right triangle problem

help
admin
c
c-plus-plus
doubt
please
problem

#1

http://www.codechef.com/problems/RIGHTRI/

for the above question my code is showing TLE but i have seen soutions with exactly same coding accepted in 0.00 time. what’s the mistake

http://www.codechef.com/viewsolution/6449998


#2

In your solution, you have a problem in the input function. You should add opening and closing braces and include ch=gc() inside the braces. I had added them but got wrong answer. Check here.


#3

oo thnx…!!
can you help me on that WA ??


#4

I just used scanf() to take input and it got accepted http://www.codechef.com/viewsolution/6454817. So that means there was a problem in the input function.Since your function does not take care of leading spaces, so I think there may leading spaces in the input file which are causing WAs.Hence I changed input() function and got AC. http://www.codechef.com/viewsolution/6454925


#5

thnx shivam… so does it means i have to keep that extra statement for further submissions… i mean is there a drawback of that statement if there are no leading spaces or any other general case?


#6

Yes, you should keep that extra statement in your further submissions. There is no harm in keeping that line. Your code will work fine whether there are leading spaces or not.