Skip to content

Instantly share code, notes, and snippets.

@volyx
Created March 5, 2017 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save volyx/e6af511e893fed74d9b478fc07fc33c6 to your computer and use it in GitHub Desktop.
Save volyx/e6af511e893fed74d9b478fc07fc33c6 to your computer and use it in GitHub Desktop.
VK cup 2017 A
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
// try (Scanner scanner = new Scanner(new FileInputStream("1"))) {
try (Scanner scanner = new Scanner(System.in)) {
int n = scanner.nextInt();
int[] years = new int[n];
for (int i = 0; i < n; i++) {
years[i] = scanner.nextInt();
}
// System.out.printf("n=" + n);
// System.out.printf("years=" + Arrays.toString(years));
Arrays.sort(years);
System.out.println(years[n/2]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment