답안 #124189

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
124189 2019-07-02T15:33:27 Z KhalilBenGamra Ice Hockey World Championship (CEOI15_bobek) Java 11
컴파일 오류
0 ms 0 KB
import java.util.*;
import java.io.*;
public class hockey {
	public static void main (String[] args){
		InputReader scan =new InputReader(System.in);
		PrintWriter out=new PrintWriter(System.out);		int nb = scan.nextInt();
		int budget = scan.nextInt();
		int[] prices = new int[nb];
		for (int i = 0; i < prices.length; i++) {
			prices[i] = scan.nextInt();
		}
		Arrays.sort(prices);
		int count = 1;
		for (int i = 0; i < prices.length; i++) {
			if(prices[i]>budget)break;
			int totalPrice = 0;
			for (int j = i; j < prices.length; j++) {
				if((totalPrice + prices[j]) > budget) {
					if(prices[j] == prices[j-1])count++;
					break;
				}
				else {
					count++;
					totalPrice += prices[j];
				}
			}
        }
			out.println(count);
      out.close();
        
}}

Compilation message

bobek.java:3: error: class hockey is public, should be declared in a file named hockey.java
public class hockey {
       ^
bobek.java:5: error: cannot find symbol
		InputReader scan =new InputReader(System.in);
		^
  symbol:   class InputReader
  location: class hockey
bobek.java:5: error: cannot find symbol
		InputReader scan =new InputReader(System.in);
		                      ^
  symbol:   class InputReader
  location: class hockey
3 errors