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.