Please tell me where I went wrong in my solution to this problem.It would be a great help for me if you please point out my mistakes.Thanks.
You should not have the line print āEnter the number of test casesā Since itās an online judge, it takes that line as the output so, only output it wants is either āElevatorā or āStairsā. And also delete those lines āv isā
Hope this helps!!
your solution
your logic seems perfectly fine, but
Input
3
5 10 15
2 10 14
7 14 10
Your output
Elevator
Expected output
Elevator
Stairs
Stairs
So for some reason, it doesnāt run enough times to solve the other test cases. Iām not familiar with C, so I donāt know whatās wrong!!
You also dont ahve a ā;ā after while loop.
while(T--);
is equivalent to
while(T--){}//Empty while loop
Fix that as well. And as @kunnu120 said, dont print superfluous print statements, its a machine checking your answer.
@vijju123 it took me so long to realize that he had a semi colon after the while loop, look at my profile I ran this program so many times. Then saw the semi colon I was like Ahh, man!! I thought the problem was with the scanf thing so I was searching the problem on google and everywhere. because I donāt know C lmao
Hahahahahahahahah
I have developed some spotting skills . I think I should apply for exam copy correction of my juniors X) evil
Second year
wow, you know more than most seniors do, when you started coding?
Roughly 6 month experience
Stay a while here and you will see for yourself wink
Iāll try my best bro
why āe = (float)2*n/V2;
s = (float)sqrt(2)*n/V1;ā when you already declared e and s as float?
but anyways thank you very much for help.
@psnarsikar āe = (float)2n/V2;ā
Itās called typecasting, you right that e and c are already float but n v1 & v2 are integers, so why we typecast?
Because if you do this āe = 2n/v2āā then what computer see is float = int which is not right by typecasting youāre saying (float = (float) int) the computer will see this as float = float thatās why we do typecasting.