Skip to content

Instantly share code, notes, and snippets.

@asi1024
Last active October 11, 2016 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asi1024/a229a8d3eef3a8b3e087f2c512ba871e to your computer and use it in GitHub Desktop.
Save asi1024/a229a8d3eef3a8b3e087f2c512ba871e to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main() {
int R0, W0, C, R;
while (cin >> R0 >> W0 >> C >> R, C) {
int rest = max(W0 * C - R0, 0);
cout << (rest + R - 1) / R << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment