728x90
--- 문제 ---
--- 코드 ---
import java.util.Scanner;
public class Bj13458 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long[] stu = new long[N];
for(int i=0; i<N; ++i) {
stu[i] = sc.nextLong();
}
long B = sc.nextInt();
long C = sc.nextInt();
long total = 0;
for(int i=0; i<N; ++i) {
if(stu[i]<=B) {
++total;
}
else {
total += Math.ceil((double)(stu[i]-B)/(double)C)+1;
}
}
System.out.println(total);
}
}
--- 출처 ---
13458번: 시험 감독
첫째 줄에 시험장의 개수 N(1 ≤ N ≤ 1,000,000)이 주어진다. 둘째 줄에는 각 시험장에 있는 응시자의 수 Ai (1 ≤ Ai ≤ 1,000,000)가 주어진다. 셋째 줄에는 B와 C가 주어진다. (1 ≤ B, C ≤ 1,000,000)
www.acmicpc.net
반응형