Advertisement
DidiHristova93

Untitled

Oct 9th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class techModuleSnowBalls {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7.  
  8. int n = Integer.parseInt(scanner.nextLine());
  9. double maxValue = Double.MIN_VALUE;
  10. int maxSnow = 0;
  11. int maxTime = 0;
  12. int maxQuality = 0;
  13.  
  14. for (int i = 0; i < n; i++) {
  15. int snow = Integer.parseInt(scanner.nextLine());
  16. int time = Integer.parseInt(scanner.nextLine());
  17. int quality = Integer.parseInt(scanner.nextLine());
  18.  
  19. double value = Math.pow(snow / time, quality);
  20.  
  21. if (maxValue < value) {
  22. maxValue = value;
  23. maxSnow = snow;
  24. maxTime = time;
  25. maxQuality = quality;
  26. }
  27.  
  28.  
  29. }
  30. System.out.println(String.format("%d : %d = %.0f (%d)",maxSnow,maxTime,maxValue,maxQuality));
  31.  
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement