🐣 알고리즘 삐약/💻 백준 삐약

82 삐약 : 백준 13458| 시험감독 [삼성 SW 역량테스트|JAVA]

우주수첩 2024. 8. 8. 16:01
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