BOJ::13458 시험 감독

https://www.acmicpc.net/problem/13458


어렵지 않은 문제인데 정답률이 왜 23%밖에 안되는지 모르겠다.

그래서 올려본다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
using namespace std;
 
int n,b,c;
int a[1000001];
 
int main() {
    scanf("%d"&n);
    for (int i = 1; i <= n; i++) {
        scanf("%d"&a[i]);
    }
    scanf("%d %d"&b, &c);
 
    long long cnt = 0;
    for (int i = 1; i <= n; i++) {
        cnt++;
        int x = a[i] - b;
        if (x > 0) {
            if (x%c == 0) {
                cnt += x / c;
            }
            else {
                cnt += x / c + 1;
            }
        }
    }
    printf("%ld\n", cnt);
}
cs


'BOJ::문제풀이' 카테고리의 다른 글

14442 벽 부수고 이동하기 2  (0) 2018.01.07
13902 개업 2  (0) 2018.01.07
13305 주유소  (4) 2018.01.07
12761 돌다리  (0) 2018.01.07
11727 2 x n 타일링2  (0) 2018.01.07

+ Recent posts