Submission #1613385
Source Code Expand
#include <iostream> #include <cstdio.h> #include <math.h> using namespace std; typedef long long LL; int N, A, B, h[(int)1e5]; bool judge(LL K) { LL sum = 0; for(int i = 0; i < N; i++) { LL t = (LL)h[i]-K*B; if (t > 0) { sum += (int)ceil(t*1.0/(A-B)); if(sum > K) return false; } } return true; } int main() { cin >> N >> A >> B; for (int i = 0; i < N; i++) scanf("%ld", &h[i]); LL low = 0, high = 1e9; while (low < high) { LL mid = (low + high) / 2; if (judge(mid)) high = mid; else low = mid+1; } cout << low << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Widespread |
User | kira924age |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 757 Byte |
Status | CE |
Compile Error
./Main.cpp:2:20: fatal error: cstdio.h: No such file or directory #include <cstdio.h> ^ compilation terminated.