Advertisement
Valeri12580

Snow Ball

Feb 5th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Snowballs {
  4. public static void main(String[] args) {
  5. Scanner scanner=new Scanner(System.in);
  6.  
  7. int n=Integer.parseInt(scanner.nextLine());
  8. int max=Integer.MIN_VALUE;
  9. int[] result=new int[3];
  10.  
  11.  
  12. for (int i = 0; i <n; i++) {
  13. int snowBallSnow=Integer.parseInt(scanner.nextLine());
  14. int snowBallTime=Integer.parseInt(scanner.nextLine());
  15. int snowBallQuality=Integer.parseInt(scanner.nextLine());
  16. if(snowBallValue(snowBallSnow,snowBallTime,snowBallQuality)>max){
  17. max=snowBallValue(snowBallSnow,snowBallTime,snowBallQuality);
  18. result[0]=snowBallSnow;
  19. result[1]=snowBallTime;
  20. result[2]=snowBallQuality;
  21. }
  22.  
  23. }
  24. System.out.printf("%d : %d = %d (%d)",result[0],result[1],max,result[2]);
  25.  
  26.  
  27.  
  28. }
  29.  
  30.  
  31. public static int snowBallValue(int snowBallSnow,int snowBallTime,int snowballQuality){
  32. int result= (int) Math.pow((snowBallSnow/snowBallTime),snowballQuality);
  33.  
  34. return result;
  35.  
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement