Created
March 5, 2017 11:59
-
-
Save volyx/e6af511e893fed74d9b478fc07fc33c6 to your computer and use it in GitHub Desktop.
VK cup 2017 A
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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