first one (with 2.0000000 is working) but second one (with only 2) is not working.
#include<math.h>
using namespace std;
int main()
{
int T,N,V1,V2;
cin>>T;
int arrn[T];
int arrv1[T];
int arrv2[T];
//v1 = chef, v2 = elevator
for (int i = 0; i < T; i++) {
cin>>arrn[i]>>arrv1[i]>>arrv2[i];
}
for (int i = 0; i < T; i++)
{
float timeOfChef = sqrt(2)*arrn[i]/arrv1[i];
float timeOfElevator = (2.000000)*arrn[i]/arrv2[i];
// cout<<"Elevator = "<<timeOfElevator<<endl<<"Chef = "<<timeOfChef<<endl;
if(timeOfElevator < timeOfChef)
{
cout<<"Elevator"<<endl;
}
else if(timeOfElevator > timeOfChef)
{
cout<<"Stairs"<<endl;
}
}
return 0;
}
#include<math.h>
using namespace std;
int main()
{
int T,N,V1,V2;
cin>>T;
int arrn[T];
int arrv1[T];
int arrv2[T];
//v1 = chef, v2 = elevator
for (int i = 0; i < T; i++) {
cin>>arrn[i]>>arrv1[i]>>arrv2[i];
}
for (int i = 0; i < T; i++)
{
float timeOfChef = sqrt(2)*arrn[i]/arrv1[i];
float timeOfElevator = (2)*arrn[i]/arrv2[i];
// cout<<"Elevator = "<<timeOfElevator<<endl<<"Chef = "<<timeOfChef<<endl;
if(timeOfElevator < timeOfChef)
{
cout<<"Elevator"<<endl;
}
else if(timeOfElevator > timeOfChef)
{
cout<<"Stairs"<<endl;
}
}
return 0;
}