Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Main {
- public static void main(String[] Args) {
- Scanner scan = new Scanner(System.in);
- int n, a[], x;
- while (true) {
- n = scan.nextInt();
- if (n == 0) {
- break;
- }
- a = new int[n]; x = 0;
- for (int i = 0; i < n; i++) {
- a[i] = scan.nextInt();
- if (a[x] < a[i]) {
- x = i;
- }
- }
- a[x] = 0;
- for (int i = 0; i < n; i++) {
- if (a[x] < a[i]) {
- x = i;
- }
- }
- System.out.println(x + 1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement