728x90
https://www.acmicpc.net/problem/13458
package BAEKJOON.Bronze.Ⅱ;
import java.util.Scanner;
public class NO13458 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int [] arr = new int [n];
long count = 0;
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
int b = sc.nextInt();
int c = sc.nextInt();
for (int i = 0; i < arr.length; i++) {
if(arr[i] <= b ) {
count ++;
continue;
} else {
count++;
arr[i] = arr[i] - b;
if(arr[i] % c == 0) {
count += arr[i]/c;
} else if(arr[i] % c != 0){
count += arr[i]/c + 1;
}
}
}
System.out.println(count);
}
}
728x90
'Algorithm & SQL > BAEKJOON' 카테고리의 다른 글
백준 JAVA 12845 모두의 마블 (0) | 2022.08.14 |
---|---|
백준 JAVA 4796 캠핑 (0) | 2022.08.14 |
백준 JAVA 2217 로프 (0) | 2022.08.13 |
백준 JAVA 11399 ATM (0) | 2022.08.13 |
백준 JAVA 11047 동전0 (0) | 2022.08.13 |
댓글