-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathWorld Cup.java
More file actions
58 lines (38 loc) · 870 Bytes
/
World Cup.java
File metadata and controls
58 lines (38 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Akash Yadav
// @Hudson Lane, Delhi
// 24th June 18
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
public class TestClass{
//http://codeforces.com/contest/996/problem/B
public static Scanner scn = new Scanner(System.in);
public static void main (String[] args) throws java.lang.Exception{
int N = scn.nextInt();
int[] arr = new int[N];
boolean allBig = true;
int small = Integer.MAX_VALUE;
for(int i = 0; i < N; i++){
arr[i] = scn.nextInt();
if(arr[i] < N)
allBig = false;
if(arr[i] < small)
small = arr[i];
}
if(allBig){
int amt = small / N;
for(int i = 0; i < N; i++)
arr[i] = arr[i] - amt*N;
}
int gate = 0;
long time = 0;
while(true){
if((long)arr[gate] - time <= 0)
break;
time++;
gate = (gate + 1)%N;
}
System.out.println(gate + 1);
}
}