제출 #491549

#제출 시각아이디문제언어결과실행 시간메모리
491549mnair797Cloud Computing (CEOI18_clo)Java
컴파일 에러
0 ms0 KiB
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class CloudComputing { static int n, m; static Computer[] arr; static int[][] computer, work; static long[] dp, pdp; public static void main(String[] args) throws IOException{ BufferedReader file = new BufferedReader(new InputStreamReader(System.in)); n = Integer.parseInt(file.readLine()); computer = new int[n][3]; int sumCores = 0; for (int i=0; i<n; i++){ StringTokenizer st = new StringTokenizer(file.readLine()); int c = Integer.parseInt(st.nextToken()); int f = Integer.parseInt(st.nextToken()); int e = Integer.parseInt(st.nextToken()); computer[i] = new int[] {c, f, e}; } m = Integer.parseInt(file.readLine()); arr = new Computer[n+m]; work = new int[m][3]; for (int i=0; i<m; i++){ StringTokenizer st = new StringTokenizer(file.readLine()); int c = Integer.parseInt(st.nextToken()); int f = Integer.parseInt(st.nextToken()); int e = Integer.parseInt(st.nextToken()); work[i] = new int[] {c, f, e}; arr[n+i] = new Computer(c, f, e, 1); } for (int i=0; i<n; i++){ arr[i] = new Computer(computer[i][0], computer[i][1], computer[i][2], 0); sumCores += computer[i][0]; } Arrays.sort(arr); dp = new long[sumCores+1]; pdp = new long[sumCores+1]; Arrays.fill(dp, (long)-2e17); Arrays.fill(pdp, (long)-2e17); pdp[0] = 0; for (int i=1; i<=n+m; i++){ for (int j=0; j<=sumCores; j++){ dp[j] = pdp[j]; if (arr[i-1].t == 0){ if (j - arr[i-1].c >= 0){ dp[j] = Math.max(dp[j], pdp[j - arr[i-1].c] - arr[i-1].earn); } }else{ if (j + arr[i-1].c <= sumCores){ dp[j] = Math.max(dp[j], pdp[j + arr[i-1].c] + arr[i-1].earn); } } } for (int j=0; j<=sumCores; j++){ pdp[j] = dp[j]; dp[j] = (long)-2e17; } } long res = 0; for (int i=0; i<=sumCores; i++){ res = Math.max(res, pdp[i]); } System.out.println(res); } static class Computer implements Comparable<Computer>{ int c, f, earn, t; public Computer(int c, int f, int earn, int t){ this.c = c; this.f = f; this.earn = earn; this.t = t; } public int compareTo(Computer o){ if (o.f == this.f){ if (this.t == o.t){ return 0; } if (this.t == 0){ return -1; }else{ return 1; } } return Integer.compare(o.f, this.f); } } }

컴파일 시 표준 에러 (stderr) 메시지

clo.java:7: error: class CloudComputing is public, should be declared in a file named CloudComputing.java
public class CloudComputing {
       ^
1 error