VioletaBabel
13458번: 시험 감독 본문
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 | #include<cstdio> #include<vector> using namespace std; int main() { int n, b, c, temp; long long int ans = 0; vector<int> a; scanf("%d", &n); for (int i = n; i--; a.push_back(temp)) scanf("%d", &temp); scanf("%d %d", &b, &c); for (int i = 0; i < n; ++i) { a[i] -= b; if (a[i] < 1) ++ans; else { if (a[i] % c == 0) ans += ((a[i] / c) + 1); else ans += ((a[i] / c) + 2); } } printf("%lld\n", ans); } | cs |
'백준 > 백준-C++' 카테고리의 다른 글
| 2442번: 별찍기 - 5 (0) | 2017.09.15 |
|---|---|
| 1652번: 누울 자리를 찾아라 (0) | 2017.09.15 |
| 재귀와 동적 프로그래밍 (0) | 2017.09.13 |
| 1149번: RGB거리 (0) | 2017.09.13 |
| 수학 및 논리 퍼즐 (0) | 2017.09.13 |
Comments