Submission #727139

#TimeUsernameProblemLanguageResultExecution timeMemory
727139dn4271A Huge Tower (CEOI10_tower)Java
Compilation error
0 ms0 KiB
import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); int n = input.nextInt(); int d = input.nextInt(); int[] blocks = new int[n]; for (int i = 0; i < n; i++) { blocks[i] = input.nextInt(); } Arrays.sort(blocks); int[] tolerance = new int[n]; tolerance[0] = 1; for (int i = 1; i < n; i++) { int j = 0; while (blocks[i] - blocks[j] > d) { j++; } tolerance[i] = i - j + 1; } int answer = 1; for (int i: tolerance) { answer = answer * i; } System.out.println(answer); } }

Compilation message (stderr)

tower.java:3: error: class Main is public, should be declared in a file named Main.java
public class Main {
       ^
1 error