하다보니
13458번-시험 감독 본문
#include<iostream>
#include<vector>
using namespace std;
int n;//시험장 개수
vector<int> people;
int b, c; //총감독관 감시 응시자수, 부감독관 감시 응시자 수
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
people.push_back(x);
}
cin >> b >> c;
long long tot=0;
for (int i = 0; i < n; i++) {
if (people[i] - b <= 0) {
tot += 1;
}
else {
tot += 1;
tot += (people[i] - b) / c;
if ((people[i] - b) % c != 0)tot += 1;
}
}
cout << tot;
}
'알고리즘 풀이 > 백준' 카테고리의 다른 글
2579번-계단 오르기 (0) | 2022.05.10 |
---|---|
14889번-스타트와 링크 (0) | 2022.04.19 |
13460번-구슬 탈출2 (0) | 2022.04.18 |
3190번-뱀 (0) | 2022.04.15 |
14499번-주사위 굴리기 (0) | 2022.04.14 |