[BOJ] 13458 시험 감독

Time Lapse :None

13458.cpp

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
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define Size 1000000
int rooms[Size];
int N, B, C;
long long ans=0;
int main(void)
{

cin>>N;
for(int i=0;i<N;i++)
cin>>rooms[i];

cin>>B>>C;


for(int i=0;i<N;i++)
{
rooms[i] -= B;
if(rooms[i]<=0)
ans = ans + 1;
else if(rooms[i]%C==0)
ans = ans + 1 + (rooms[i]/C);
else
ans = ans + 2 + (rooms[i]/C);
}

cout<<ans<<endl;
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/07/23/PS/BOJ/13458/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.