728x90
https://www.acmicpc.net/problem/13458
package SS_SW;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class BOJ_13458 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
int[] classes = new int[N];
StringTokenizer st = new StringTokenizer(br.readLine());
for(int i=0;i<N;i++){
classes[i] = Integer.parseInt(st.nextToken());
}
st = new StringTokenizer(br.readLine());
int B = Integer.parseInt(st.nextToken());
int C = Integer.parseInt(st.nextToken());
long count= N;
for(int i=0;i<N;i++){
classes[i]-=B;
if (classes[i] <= 0) continue;
count += classes[i]/C;
if(classes[i]%C>0) count++;
}
System.out.println(count);
br.close();
}
}
728x90
'🐣 알고리즘 삐약 > 💻 백준 삐약' 카테고리의 다른 글
84 삐약 : 백준 15650| N과 M (2) [바킹독| 백트래킹 |JAVA] (0) | 2024.08.13 |
---|---|
83 삐약 : 백준 15649| N과 M (1) [바킹독| 백트래킹 |JAVA] (0) | 2024.08.13 |
81 삐약 : 백준 1149| RGB거리 [바킹독 문제 풀이|DP|JAVA] (0) | 2024.06.19 |
80 삐약 : 백준 14501| 퇴사 [바킹독 문제 풀이|DP|JAVA] (0) | 2024.06.18 |
79 삐약 : 백준 9461| 파도반 수열 [바킹독 문제 풀이|DP|JAVA] (0) | 2024.06.18 |