fork download
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5. public static void main(String[] args) {
  6. // TODO Auto-generated method stub
  7. Scanner input = new Scanner(System.in);
  8.  
  9. int[] 배열 = new int[9];
  10.  
  11. for (int i = 0; i < 9; i++) {
  12. int a = input.nextInt();
  13. 배열[i] = a;
  14. }
  15.  
  16. int max = 배열[0];
  17. for (int i = 1; i < 배열.length - 1; i++) {
  18. if (max < 배열[i])
  19. max = 배열[i];
  20. }
  21. System.out.println(max);
  22. int 위치;
  23. for (int i = 0; i < 9; i++)
  24. if (배열[i] == max) {
  25. 위치 = i;
  26. System.out.println(위치 + 1);
  27. }
  28.  
  29. }
  30.  
  31. }
  32.  
Success #stdin #stdout 0.15s 56676KB
stdin
1
2
3
4
5
6
7
8
9
stdout
8
8