Advertisement
Guest User

Untitled

a guest
Dec 23rd, 2022
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. package DataTypesAndVariablesExercises;
  2.  
  3. import java.math.BigInteger;
  4. import java.util.Scanner;
  5.  
  6. public class E11Snowballs {
  7. public static void main(String[] args) {
  8. Scanner scan = new Scanner(System.in);
  9. int number = Integer.parseInt(scan.nextLine());
  10. int snow = 0;
  11. int time = 0;
  12. int quality = 0;
  13. String format = "";
  14. BigInteger maxValue = BigInteger.valueOf(Integer.MIN_VALUE);
  15.  
  16. BigInteger totalValue = BigInteger.valueOf(0);
  17.  
  18. for (int i = 1; i <= number; i++) {
  19. snow = Integer.parseInt(scan.nextLine());
  20. time = Integer.parseInt(scan.nextLine());
  21. quality = Integer.parseInt(scan.nextLine());
  22. totalValue = BigInteger.valueOf((int) Math.pow((snow / time), quality));
  23. if (totalValue.compareTo(maxValue) >= 0) {
  24. maxValue = totalValue;
  25. format = String.format("%d : %d = %d (%d)", snow, time, maxValue, quality);
  26. }
  27.  
  28. }
  29. System.out.println(format);
  30. }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement