pages:
  • 1
Jamshid SAYS

Salam. man to in soal baraye mesale khodesh ham javabi ke be dast miaram vaghti gerdesh mikonam .01 bishtar az sample output mishe. hata sample input ha ro dakhel site haye riazi vared kardam baz javabe man ro midan. age emkanesh hast komakam konid

AMiR SAYS

The output specification stated

The output value should be such that the Speed Racer will not run out of fuel (so truncate, rather than round, the final result)

So you have to truncate the result. For example, 3.146 should be printed 3.14.

In order to do this, you can either do this:

// the variable `ans` is double
double output = (double)((int)(100*ans))/100.0

Or decrease the answer by 0.005 then round it.

printf("%.2f\n", ans-0.005);