Task
One construction company wants to minimize paint expenses. For this reason has to be made a program which can calculate an amount of a paint for the each order. Usually the owner know the longness L , wideness W , and highness H of the each room. Also one can of pain is good enough to paint 16 m2, and the size of windows and doors are not important in this calculation
Input:
In the first line should be orders` amount. In the each next line — L, W, H and the wideness, longness, and highness are not more than 1000 .
Output:
For the each order will be shown one one number, what is required amount of the paint cans
Tests
Input | Output | |
---|---|---|
2 | ||
8 8 2 | 4 | |
1 1 3 | 1 | |
10 6 2 | 4 | |
11 6 2 | 5 |
Solution
Task «Repair» can be solved by using Data Strim processing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import java.util.*; import java.io.*; class Main{ public static void main (String[] args) throws java.lang.Exception{ Scanner s = new Scanner(System.in); double order = s.nextDouble(); for(int i = 0; i < order; i++){ double l = s.nextDouble(); double w = s.nextDouble(); double h = s.nextDouble(); int quantity =(int)Math.ceil(h * (l + w) / 8); System.out.println(quantity); } } } |