fork download
  1. import java.util.Scanner;
  2. public class Main {
  3. public static void input(int [][] array) {
  4. Scanner sc = new Scanner(System.in);
  5. for (int i=0;i<array.length;i++) {
  6. for (int j=0;j<array[i].length;j++) {
  7. int num = sc.nextInt();
  8. array[i][j] = num;
  9. }
  10. }
  11. }
  12. public static void findmax(int [][] array) {
  13. int max = array[0][0];
  14. int x = 0;
  15. int y = 0;
  16. for (int i=0;i<array.length;i++) {
  17. for (int j=0;j<array[i].length;j++) {
  18. if (array[i][j] > max) {
  19. max = array[i][j];
  20. x = i+1;
  21. y = j+1;
  22. }
  23. }
  24. }
  25. System.out.println(max);
  26. System.out.println(x + " " + y);
  27. }
  28. public static void main(String[] args) {
  29. int [][] array = new int[9][9];
  30. input(array);
  31. findmax(array);
  32. }
  33. }
Success #stdin #stdout 0.22s 60916KB
stdin
91 23 85 34 17 74 25 52 65
10 7 39 42 88 52 14 72 63
87 42 18 78 53 45 18 84 53
34 28 64 85 12 16 75 36 55
21 77 45 35 28 75 90 76 1
25 87 65 15 28 11 37 28 74
65 27 75 41 7 89 78 64 39
47 47 70 45 23 65 3 41 44
87 13 82 38 31 12 29 29 80
stdout
91
0 0