답안 #98041

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
98041 2019-02-20T02:19:42 Z Sharon Brunhilda’s Birthday (BOI13_brunhilda) Java 11
0 / 100
277 ms 14956 KB
import java.util.*;

class brunhilda {

	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);
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 277 ms 14956 KB Output isn't correct
2 Runtime error 127 ms 10880 KB Execution failed because the return code was nonzero
3 Incorrect 143 ms 11032 KB Output isn't correct
4 Runtime error 155 ms 10984 KB Execution failed because the return code was nonzero
5 Incorrect 147 ms 11248 KB Output isn't correct
6 Incorrect 243 ms 14756 KB Output isn't correct
7 Incorrect 139 ms 10996 KB Output isn't correct
8 Incorrect 154 ms 11528 KB Output isn't correct
9 Incorrect 166 ms 11196 KB Output isn't correct
10 Runtime error 162 ms 11060 KB Execution failed because the return code was nonzero
11 Runtime error 134 ms 10892 KB Execution failed because the return code was nonzero
12 Runtime error 152 ms 10988 KB Execution failed because the return code was nonzero
13 Runtime error 135 ms 11116 KB Execution failed because the return code was nonzero
14 Runtime error 137 ms 11008 KB Execution failed because the return code was nonzero
15 Runtime error 135 ms 11064 KB Execution failed because the return code was nonzero
16 Runtime error 154 ms 11100 KB Execution failed because the return code was nonzero
17 Runtime error 133 ms 11020 KB Execution failed because the return code was nonzero
18 Runtime error 137 ms 11040 KB Execution failed because the return code was nonzero
# 결과 실행 시간 메모리 Grader output
1 Runtime error 128 ms 11068 KB Execution failed because the return code was nonzero
2 Runtime error 130 ms 11556 KB Execution failed because the return code was nonzero
3 Runtime error 130 ms 11280 KB Execution failed because the return code was nonzero
4 Runtime error 127 ms 11160 KB Execution failed because the return code was nonzero
5 Runtime error 152 ms 11340 KB Execution failed because the return code was nonzero
6 Runtime error 155 ms 10936 KB Execution failed because the return code was nonzero
7 Runtime error 163 ms 10912 KB Execution failed because the return code was nonzero
8 Runtime error 162 ms 10968 KB Execution failed because the return code was nonzero
9 Runtime error 147 ms 11188 KB Execution failed because the return code was nonzero
10 Runtime error 146 ms 11204 KB Execution failed because the return code was nonzero
11 Runtime error 161 ms 10964 KB Execution failed because the return code was nonzero
12 Runtime error 153 ms 11100 KB Execution failed because the return code was nonzero
13 Runtime error 137 ms 11052 KB Execution failed because the return code was nonzero
14 Runtime error 150 ms 10896 KB Execution failed because the return code was nonzero
15 Runtime error 141 ms 11300 KB Execution failed because the return code was nonzero
16 Runtime error 147 ms 11408 KB Execution failed because the return code was nonzero
17 Runtime error 142 ms 10988 KB Execution failed because the return code was nonzero
18 Runtime error 161 ms 11284 KB Execution failed because the return code was nonzero
# 결과 실행 시간 메모리 Grader output
1 Runtime error 153 ms 11104 KB Execution failed because the return code was nonzero
2 Runtime error 142 ms 11224 KB Execution failed because the return code was nonzero
3 Runtime error 142 ms 11116 KB Execution failed because the return code was nonzero
4 Runtime error 150 ms 10948 KB Execution failed because the return code was nonzero
5 Runtime error 135 ms 11444 KB Execution failed because the return code was nonzero
6 Runtime error 135 ms 11108 KB Execution failed because the return code was nonzero
7 Runtime error 128 ms 11444 KB Execution failed because the return code was nonzero
8 Runtime error 139 ms 11228 KB Execution failed because the return code was nonzero
9 Runtime error 136 ms 11196 KB Execution failed because the return code was nonzero
10 Runtime error 128 ms 10992 KB Execution failed because the return code was nonzero
11 Runtime error 138 ms 10924 KB Execution failed because the return code was nonzero
12 Runtime error 133 ms 11128 KB Execution failed because the return code was nonzero
13 Runtime error 121 ms 11128 KB Execution failed because the return code was nonzero
14 Runtime error 135 ms 10944 KB Execution failed because the return code was nonzero
15 Runtime error 138 ms 10888 KB Execution failed because the return code was nonzero
16 Runtime error 131 ms 10980 KB Execution failed because the return code was nonzero
17 Runtime error 125 ms 11092 KB Execution failed because the return code was nonzero
18 Runtime error 146 ms 11476 KB Execution failed because the return code was nonzero
19 Runtime error 166 ms 10996 KB Execution failed because the return code was nonzero
20 Runtime error 154 ms 11300 KB Execution failed because the return code was nonzero
21 Runtime error 160 ms 11024 KB Execution failed because the return code was nonzero
22 Runtime error 163 ms 11496 KB Execution failed because the return code was nonzero
23 Runtime error 130 ms 11188 KB Execution failed because the return code was nonzero
24 Runtime error 136 ms 11072 KB Execution failed because the return code was nonzero
25 Runtime error 144 ms 11076 KB Execution failed because the return code was nonzero
26 Runtime error 126 ms 11104 KB Execution failed because the return code was nonzero
27 Runtime error 140 ms 11496 KB Execution failed because the return code was nonzero
28 Runtime error 123 ms 11072 KB Execution failed because the return code was nonzero
29 Runtime error 147 ms 11424 KB Execution failed because the return code was nonzero
30 Runtime error 140 ms 11372 KB Execution failed because the return code was nonzero
31 Runtime error 134 ms 11124 KB Execution failed because the return code was nonzero
32 Runtime error 131 ms 11116 KB Execution failed because the return code was nonzero
33 Runtime error 131 ms 10892 KB Execution failed because the return code was nonzero
34 Runtime error 158 ms 11364 KB Execution failed because the return code was nonzero
35 Runtime error 152 ms 11040 KB Execution failed because the return code was nonzero
36 Runtime error 141 ms 11288 KB Execution failed because the return code was nonzero
37 Runtime error 168 ms 11328 KB Execution failed because the return code was nonzero
38 Runtime error 151 ms 11024 KB Execution failed because the return code was nonzero
39 Runtime error 165 ms 10972 KB Execution failed because the return code was nonzero
40 Runtime error 145 ms 11168 KB Execution failed because the return code was nonzero
41 Runtime error 149 ms 11308 KB Execution failed because the return code was nonzero
42 Runtime error 176 ms 11008 KB Execution failed because the return code was nonzero