0

Input
The input file contains two integers. The first one is the spent time in the trip (in hours). The second one is the average speed during the trip (in Km/h).

Output
Print how many liters would be needed to do this trip, with three digits after the decimal point.

Problem number 1017 so I take two integer in input file and three digit after decimal point in output file but getting wrong answer (60%). Here is the code:

import java.util.Scanner;
public class Main{
    public static void main( String args []){
        Scanner sc=new Scanner (System.in);
        int x,y;
        x=sc.nextInt();
        y=sc.nextInt();
        double z=(x*y)/12;
        System.out.printf("%.3f\n",z);
    }
}

What is the 60% wrong answer?

1 Answers1

-1

What are the constraints?
If the integers are large, maybe you should use long instead of int.
If they are larger than that, use BigInteger or BigDecimal.

S. Plum P.
  • 151
  • 8