Skip to content

Instantly share code, notes, and snippets.

@developer-sdk
Created February 14, 2019 11:13
Show Gist options
  • Select an option

  • Save developer-sdk/fe0069e0666c5ab3fef2184b1f47d7f2 to your computer and use it in GitHub Desktop.

Select an option

Save developer-sdk/fe0069e0666c5ab3fef2184b1f47d7f2 to your computer and use it in GitHub Desktop.
package sdk.backjun;
import java.util.Scanner;
/**
* 백준, 13458
* 시험 감독관
*
* @author whitebeard-k
*
*/
public class Problem13458 {
static int N;
static int B;
static int C;
static int[] person;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
N = sc.nextInt();
person = new int[N];
for (int i = 0; i < N; i++)
person[i] = sc.nextInt();
B = sc.nextInt();
C = sc.nextInt();
sc.close();
long sum = 0;
for (int num : person) {
sum += 1;
num -= B;
if (num > 0) {
int result = num / C;
int mod = num % C;
sum += result + (mod == 0 ? 0 : 1);
}
}
System.out.println(sum);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment