[C언어] 13458. 시험감독

SW 업무 관련/백준

[C언어] 13458. 시험감독

WillBe_ 2018. 10. 17. 00:31



이 문제야 말로 정답률에 속지 마라! 문제.


자료형에 주의하자...후.......


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
29
30
31
32
33
34
35
36
37
#include <stdio.h>
 
int arr[1000011];
 
int main()
{
    int N, A, B;
    int temp1 = 0, temp2 = 0, temp = 0;
    long long total = 0;
    scanf("%d"&N);
    
    for (int i = 0; i < N; i++)
        scanf("%d"&arr[i]);
 
    scanf("%d %d"&A, &B);
 
    total = N;
    for (int j = 0; j < N; j++)
    {
        temp = arr[j] - A;
 
        if (temp > 0)
        {
            temp1 = temp / B;
            temp2 = temp % B;
 
            if (temp2 > 0)
                temp2 = 1;
 
            total += temp1 + temp2;
        }
    }
 
    printf("%lld\n",total);
 
    return 0;
}
cs