백준알고리즘
시험 감독
먼지의삶
2019. 7. 17. 21:53
#include<iostream>
#include<cstdio>
using namespace std;
int n;
int a[1000000];
int b, c;
long long check(long long a, long long c) {
long long result = 0;
if (a != 0) {
if (a % c == 0) {
result += (a / c);
}
else
result += (a / c) + 1;
return result;
}
else return 0;
}
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
scanf("%d %d", &b, &c);
long long result = n;
for (int i = 0; i < n; i++) {
a[i] = a[i] - b;
if (a[i] < 0) a[i] = 0;
}
for (int i = 0; i < n; i++) {
result += check(a[i], c);
}
printf("%lld\n", result);
return 0;
}
데이터 양자체는 크지않은데 데이터 하나하나의 크기가 좀 클거같아서 long long으로 선언하고 진행했다.
아마, 정답률이 낮은이유는, 데이터 크기에 상관안하고 일반적으로 int로 선언하고 문제를 풀어서 정답률이 낮은듯