Submission #934200

#TimeUsernameProblemLanguageResultExecution timeMemory
934200tkaimA Huge Tower (CEOI10_tower)Java
Compilation error
0 ms0 KiB
import java.io.*; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class App { public static void main(String[] args) throws IOException { //BufferedReader reader = new BufferedReader(new FileReader(new File("diamond.in"))); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); //PrintWriter out = new PrintWriter(new FileWriter(new File("diamond.out"))); StringTokenizer sTokenizer = new StringTokenizer(reader.readLine()); int numCount = Integer.parseInt(sTokenizer.nextToken()); int difference = Integer.parseInt(sTokenizer.nextToken()); int[] blocks = new int[numCount]; sTokenizer = new StringTokenizer(reader.readLine()); for(int i = 0; i < numCount; i++) { blocks[i] = Integer.parseInt(sTokenizer.nextToken()); } Arrays.sort(blocks); int answer = 1; int upBlock = 1; for(int i = 0; i < numCount; i++) { if(upBlock >= numCount - 1) { int num = numCount - 1 - i; if(num != 0) { answer *= num; } continue; } if(blocks[upBlock] > difference + blocks[i]) { int num = upBlock - i; if(num != 0) { answer *= num; } continue; } i--; upBlock++; } out.println(answer); out.close(); } }

Compilation message (stderr)

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