Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.lang.*;
- import java.io.*;
- /* Name of the class has to be "Main" only if the class is public. */
- class Ideone
- {
- public static void main (String[] args) throws java.lang.Exception
- {
- BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
- int zestawy = 0;
- try {
- zestawy = Integer.valueOf(bf.readLine());
- } catch (IOException e) {
- e.printStackTrace();
- }
- double dzieciak = 0;
- double[] returnArray = new double[zestawy];
- for (int i = 0; i < zestawy; i++) {
- String input = null;
- try {
- input = bf.readLine();
- } catch (IOException e) {
- e.printStackTrace();
- }
- if (input.equals(null)) {
- break;
- }
- String[] inputArray = input.split(" ");
- double oIleStarszaMatka = Integer.valueOf(inputArray[0]);
- double zaIleLat = Integer.valueOf(inputArray[1]);
- double ileRazyBedzieStarsza = Integer.valueOf(inputArray[2]);
- double leftSide = oIleStarszaMatka+zaIleLat;
- double rightSide = zaIleLat*ileRazyBedzieStarsza;
- dzieciak = (rightSide - leftSide) / (ileRazyBedzieStarsza - 1);
- dzieciak = Math.round(12 * dzieciak);
- returnArray[i] = dzieciak;
- }
- for (double i : returnArray) {
- System.out.println((int) i);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment