Where did I go wrong?

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!!

1 Like

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.

Hereā€™s your working solution link text

@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

1 Like

Hahahahahahahahah :stuck_out_tongue:

I have developed some spotting skills :stuck_out_tongue: . I think I should apply for exam copy correction of my juniors X) evil

@vijju123 hahaha are you senior? what year?

Second year :smiley:

1 Like

wow, you know more than most seniors do, when you started coding?

1 Like

Roughly 6 month experience :smiley:

1 Like

@vijju123 youā€™re very fast learner!! tell me the secret ingredient you have!! Lol

Stay a while here and you will see for yourself wink :wink:

1 Like

@vijju123 Iā€™ll try my best bro

1 Like

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.