답안 #98038

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
98038 2019-02-20T02:17:15 Z Sharon Brunhilda’s Birthday (BOI13_brunhilda) Java 11
컴파일 오류
0 ms 0 KB
import java.util.*;

public class BrunhildasBirthday {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int t = scan.nextInt();
		int[] p = new int[n];
		long prod = 1;
		for(int i = 0; i < n; i++){
			p[i] = scan.nextInt();
			if(Long.MAX_VALUE/p[i] > prod)
				prod *= p[i];
			else break;
		}
		for(int q = 1; q <= t; q++){
			int m = scan.nextInt();
			if(m >= prod){
				System.out.println("oo");
				continue;
			}
			int ans = 0;
			while(m > 0){
				ans++;
				for(int i = n-1; i >= 0; i--){
					if(m%p[i] != 0){
						m -= m%p[i];
						break;
					}
				}
			}
			System.out.println(ans);
		}
	}
}

Compilation message

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