text stringlengths 49 983k |
|---|
#include <bits/stdc++.h>
int main() {
float a, b, c;
scanf("%f %f %f", &a, &b, &c);
printf("%d\n", (int)ceil((a * c - b * c) / b));
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int size, speed, length;
scanf("%d %d %d", &size, &speed, &length);
int seconds = 0;
int a = size * length;
int b = speed * length;
while (a > b) {
a -= speed;
seconds++;
}
printf("%d", seconds);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int a, b, c;
cin >> a >> b >> c;
if (a <= b) {
cout << 0;
} else {
if (c * (a - b) % b == 0) {
cout << c * (a - b) / b;
} else {
cout << c * (a - b) / b + 1;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int l = 1, u = a * c, pos = -1;
while (l <= u) {
int mid = (l + u) / 2;
int z = b * c;
int z1 = a * c;
int val = (mid * b) + (b * c);
if (val == a * c) {
pos = mid;
break;
}
if (val > a * c) {
pos = mid;
u = mid - 1;
} else {
l = mid + 1;
}
}
int val = (a * c) - (b * c);
if (val <= 0) {
puts("1");
return 0;
}
int z1 = val / b;
if (b * z1 != val) {
z1++;
}
cout << z1 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
const double PI = 3.14159;
vector<pair<int, int> > corner;
vector<int> v;
long long n, m, k, d, c, a, b, ans;
set<string> st;
string s;
bool flag;
set<string>::iterator it;
map<int, char> mp;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cin >> a >> b >> c;
k = (a * c - c * b) / b;
if ((a * c - c * b) % b != 0) k++;
cout << k << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
long long a, b, c;
cin >> a >> b >> c;
long long ans = (a * c - (c - 1) * b - 1) / b;
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
float a, b, c;
while (cin >> a >> b >> c) {
float i = 0.0;
for (; i < a * c / b - c; i += 1)
;
cout << i << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
cin >> a >> b >> c;
int l = 0, r = 1000000000;
while (l < r) {
int x = (l + r) / 2;
if (c * a / b > c + x)
l = x + 1;
else
r = x;
}
cout << r;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int tot = 0, co = 0;
while (tot < a * c) {
co++;
if (tot >= a * c - b * c) break;
tot += b;
}
cout << co - 1;
int i;
cin >> i;
}
|
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long int a, b, c;
cin >> a >> b >> c;
if (a * c % b == 0)
cout << (a * c) / b - c << endl;
else
cout << ((a * c) / b - c + 1) << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << (a * c - b * c) / b + (((a * c - b * c) % b) > 0) ? 1 : 0;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
bool ok(int m) {
for (int i = 0; i <= c; i++) {
if ((m + i) * b < i * a) return false;
}
return true;
}
int minWait() {
int lo = 0, hi = a * c, mid;
while (lo < hi) {
mid = lo + (hi - lo) / 2;
if (ok(mid))
hi = mid;
else
lo = mid + 1;
}
return lo;
}
int main() {
scanf("%d %d %d", &a, &b, &c);
cout << minWait();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int t = ceil(1.0 * a * c / b);
cout << max(0, t - c) << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
int a, b, c;
cin >> a;
cin >> b;
cin >> c;
if (a < b) {
cout << 0;
return 0;
}
float duration = c * (a - b);
int t = ceil(duration / b);
cout << t;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int l = 1, r = 1e6 + 6, ans = 0;
while (l <= r) {
int mid = (l + r) / 2;
bool z = true;
int k = b * mid;
int w = 0;
for (int i = 1; i <= c; i++) {
k += b;
k -= a;
if (k < 0) {
z = false;
}
}
if (z) {
r = mid - 1;
} else {
ans = mid;
l = mid + 1;
}
}
if (ans == 0)
cout << 1;
else
cout << ans + 1;
}
|
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int inf = (int)1e9;
const int MAX_N = 100 * 1000 + 1000;
int main() {
int a, b, c;
cin >> a >> b >> c;
for (int t = 0;; t++) {
if ((t + c) * b >= c * a) {
cout << t << endl;
return 0;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool isV(char ch) {
return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
}
bool f(int t, int a, int b, int c) {
for (int t0 = t; t0 <= c + t; t0++) {
int dneed = (t0 - t) * a;
int dr = t0 * b;
if (dr < dneed) return false;
}
return true;
}
void tc() {
int a, b, c;
cin >> a >> b >> c;
int l = 0, hi = a * c, mid, ans;
while (l <= hi) {
mid = l + (hi - l) / 2;
if (f(mid, a, b, c) == true) {
ans = mid;
hi = mid - 1;
} else
l = mid + 1;
}
cout << ans;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
tc();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
cin >> a >> b >> c;
long long boss = (b - a) * c;
boss = abs(boss);
cout << ceil((double)boss / (double)b) << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, s = 0, x = 0, j;
cin >> a >> b >> c;
s = (a * c) - (b * c);
x = s / b;
if (s % b != 0) x++;
cout << x;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int time;
time = a * c;
int l = 0, r = 1e6;
while (r > l + 1) {
int x = (l + r) / 2;
if (b * (x + c) >= time)
r = x;
else
l = x;
}
cout << r;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << (c * (a - b) - 1) / b + 1;
}
|
#include <bits/stdc++.h>
int min(int a, int b) { return a < b ? a : b; }
int main() {
int D, V, L;
scanf("%d %d %d", &D, &V, &L);
int ini = 0, fim = (D * L + 1) / V;
while (ini <= fim) {
int meio = (ini + fim) / 2;
int S = V * meio + V * L;
if (S >= D * L)
fim = meio - 1;
else
ini = meio + 1;
}
printf("%d\n", fim + 1);
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int i, a, b, c, k, size;
scanf("%d %d %d", &a, &b, &c);
size = a * c / b;
k = 0;
for (i = 1; i <= size; i++) {
k = a * c - b * i;
if ((b * c) >= k) break;
}
printf("%d", i);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a, b, c;
cin >> a >> b >> c;
for (int i = 1;; i++) {
int sum = i * b;
bool p = true;
for (int j = 0; j < c; j++) {
sum += b;
sum -= a;
if (sum < 0) {
p = false;
break;
}
}
if (p) {
cout << i;
return 0;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int t = 0, tend = c * a, ans = 0;
while (t <= tend) {
int mid = t + (tend - t) / 2;
if (b * mid + c * b >= c * a) {
ans = mid;
tend = mid - 1;
} else {
t = mid + 1;
}
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int x = c * a - c * b;
int y = x / b;
if (y * b < x) y++;
cout << y << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
scanf("%d%d%d", &a, &b, &c);
printf("%d\n", (a * c / b) + (bool)((a * c) % b) - c);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int x = (a * c) - (b * c);
cout << ceil(float(x) / b) << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long i, a, b, c, l, r, mid;
cin >> a >> b >> c;
l = 0;
r = 10000000;
while (l < r) {
mid = l + (r - l) / 2;
if (mid * b + c * b >= c * a)
r = mid;
else
l = mid + 1;
}
cout << l << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, totData, sec, wait;
cin >> a >> b >> c;
totData = a * c;
sec = totData / b;
if (totData % b > 0) {
sec++;
}
wait = sec - c;
if (wait == 0) {
wait = 1;
}
cout << wait;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
double a, b, c, ans;
int xceptor() {
cin >> a >> b >> c;
ans = ((a - b) * c) / b;
cout << (long long)(ceil(ans * 1LL)) << endl;
return 0;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
return xceptor();
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int t = ((a * c) + b - 1) / b;
int h = t;
while (h--) {
if (t * b < (t - h) * a) break;
}
cout << h + 1;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
scanf("%d %d %d", &a, &b, &c);
cout << ((a * c) - (b * c) + b - 1) / b << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
float a, b, c;
float x;
cin >> a >> b >> c;
x = ceil((a * c / b) - c);
if (x <= 0)
cout << x;
else
cout << x;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5;
long long int i, j, k;
int main() {
long long int p, k, a, b, c;
cin >> a >> b >> c;
k = (a - b) * c;
p = ceil((float)k / b);
cout << p;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int s = a * c;
int ss = b * c;
s -= ss;
if (s < 0)
cout << 0;
else if (s % b == 0)
cout << s / b;
else
cout << s / b + 1;
}
|
#include <bits/stdc++.h>
int main() {
int countData, countDataInSecond, countSecond;
scanf("%d%d%d", &countData, &countDataInSecond, &countSecond);
float t = countData - countDataInSecond;
int waiting = ceil((countSecond * t) / countDataInSecond);
printf("%d", waiting);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, a, b, c, s;
while (cin >> a >> b >> c) {
s = a * c;
int min = b * c;
int n = s - min;
if (n % b == 0)
n = n / b;
else
n = n / b + 1;
cout << n << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int a, b, c;
cin >> a >> b >> c;
int x = (a * c) - (b * c);
int rem = 0;
rem = ceil((float)x / b);
cout << rem;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
double a, b, c;
cin >> a >> b >> c;
long int ans = ceil(((a - b) * c) / b);
cout << ans << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
template <class T>
void splitstr(const string &s, vector<T> &out) {
istringstream in(s);
out.clear();
copy(istream_iterator<T>(in), istream_iterator<T>(), back_inserter(out));
}
template <class T>
T gcd(T a, T b) {
return b ? gcd(b, a % b) : a;
}
static void redirect(int argc, const char **argv) {
if (argc > 1) {
static filebuf f;
f.open(argv[1], ios::in);
cin.rdbuf(&f);
if (!cin) {
cerr << "Failed to open '" << argv[1] << "'" << endl;
exit(1);
}
}
if (argc > 2) {
static filebuf f;
f.open(argv[2], ios::out | ios::trunc);
cout.rdbuf(&f);
if (!cout) {
cerr << "Failed to open '" << argv[2] << "'" << endl;
}
}
}
int main(int argc, const char **argv) {
redirect(argc, argv);
long long A, B, C;
cin >> A >> B >> C;
long long data = C * A;
long long down_time = (data + B - 1) / B;
long long t = max(0LL, down_time - C);
cout << t << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << (int)ceil((a - b) * c * 1.0 / b) << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
int r = ceil(a * c / (double)(b));
for (int i = r; i >= 0; i--) {
int d = a * c - (i + c - 1) * b;
if (d <= 0) continue;
if (d / (double)(b) > 1.0) {
printf("%d", i + 1);
return 0;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int total = a * c;
while (total % b != 0) {
total++;
}
for (int i = 1; i <= c; i++) {
total -= b;
}
cout << total / b;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
float t = (a * c - c * b) / (float)b;
if ((int)t == t)
cout << (int)t << endl;
else
cout << (int)(t + 1) << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << (a * c + b - 1) / b - c;
}
|
#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793238L;
int main() {
int a, b, c;
cin >> a >> b >> c;
int x, y, z;
x = a - b;
y = x * c;
z = ((y + b) - 1) / b;
cout << z << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, l;
cin >> n >> m >> l;
int c = (n * l) - (m * l);
int x = c / m;
if (c % m == 0) {
cout << x;
} else {
cout << x + 1;
}
}
|
#include <bits/stdc++.h>
using namespace std;
const int dx[] = {0, -1, 0, 1, -1, -1, 1, 1};
const int dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
int main() {
int a, b, c;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
a *= c;
int l = 1, r = 1000000, mid;
while (l < r) {
mid = l + (r - l) / 2;
if (mid * b + b * c >= a)
r = mid;
else
l = mid + 1;
}
printf("%d", r);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c, mul;
bool ok(int mid) {
int dif = mul - (b * mid);
int ans = (dif + b - 1) / b;
if (ans <= c)
return true;
else
return false;
}
void solve() {
cin >> a >> b >> c;
mul = a * c;
int lo = 0;
int hi = (mul + b - 1) / b;
while (hi > lo) {
int mid = (hi + lo) / 2;
if (ok(mid)) {
hi = mid;
} else
lo = mid + 1;
}
cout << lo;
}
int main() { solve(); }
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, s;
scanf("%d%d%d", &a, &b, &c);
s = (a * c) / b - c;
if ((a * c) % b) s++;
printf("%d\n", s);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long t = 1, a, b, c, total_data;
bool can(long long predicted_time) {
long long waited_data = predicted_time * b;
long long completed_data = b * c;
return waited_data + completed_data >= total_data;
}
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
while (t--) {
cin >> a >> b >> c;
total_data = a * c;
long long lo = 1, hi = 1e10, mid = 0, ans = -1;
while (lo <= hi) {
mid = lo + (hi - lo) / 2;
if (can(mid)) {
ans = mid;
hi = mid - 1;
} else {
lo = mid + 1;
}
}
cout << ans << '\n';
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, required, secnds;
cin >> a >> b >> c;
required = a * c;
if (required % b == 0)
secnds = required / b;
else
secnds = (required / b) + 1;
cout << secnds - c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int a, b, c;
cin >> a >> b >> c;
if ((a * c) % b == 0) {
cout << (((a * c) / b) - c);
} else {
cout << (((a * c) / b) - c + 1);
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
while (cin >> a >> b >> c) {
if (b >= a)
puts("0");
else {
int can = (a - b) * c / b;
can = max(can - 5, 0);
while (true) {
if ((a - b) * c <= can * b) break;
++can;
}
cout << can << endl;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool ktra(int a, int b, int c, int t) {
int i;
int have = t * b;
int need = 0;
for ((i) = (t + 1); (i) <= (c + t); (i)++) {
need += a;
have += b;
if (have < need) return false;
}
return true;
}
void input() {
int a, b, c, dau, giua, cuoi;
scanf("%d %d %d", &a, &b, &c);
dau = 0, cuoi = c * a;
while (dau <= cuoi) {
giua = (dau + cuoi) >> 1;
if (ktra(a, b, c, giua))
cuoi = giua - 1;
else
dau = giua + 1;
}
printf("%d", dau);
}
int main() {
input();
return 0;
}
|
#include <bits/stdc++.h>
long long a, b, c;
using namespace std;
bool ok(long long mid);
long long low = 0, high = 1e12 + 100;
long long mid;
int main() {
cin >> a >> b >> c;
while (low < high) {
mid = low + (high - low + 1) / 2;
if (ok(mid))
high = mid - 1;
else
low = mid;
}
cout << ++high << endl;
return 0;
}
bool ok(long long mid) {
if (b * mid + b * c >= a * (c))
return 1;
else
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
const double PI = 3.14159;
vector<pair<int, int> > corner;
vector<int> v;
long long n, m, k, d, c, a, b, ans;
set<string> st;
string s;
bool flag;
set<string>::iterator it;
map<int, char> mp;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cin >> a >> b >> c;
long long want = (a * c + b - 1) / b;
long long l = 1, r = want;
while (l <= r) {
long long mid = (l + r) / 2;
if ((want)*b >= (want - mid) * a) {
ans = mid;
r = mid - 1;
} else
l = mid + 1;
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
float res;
cin >> a >> b >> c;
res = ((float)(a - b) / (float)b);
res = res * c;
a = res;
if (res == a)
cout << a;
else
cout << (a + 1);
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int a, b, c;
while (scanf("%d%d%d", &a, &b, &c) != EOF) {
int res = c * (a - b) / b;
if (c * (a - b) % b != 0) res++;
printf("%d\n", res);
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void adskiy_razgon() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
const int mxN = 1e+9 + 7;
const long long INF = 1e+18 + 7;
long long nod(long long a, long long b) {
if (b > a) {
swap(a, b);
}
while (b > 0) {
a %= b;
swap(a, b);
}
return a;
}
long long nok(long long a, long long b) { return a * b / nod(a, b); }
void sp(long long a, double b) { cout << fixed << setprecision(a) << b; }
long long binpow(long long a, long long n) {
if (n == 0) {
return 1;
}
if (n % 2 == 1) {
return binpow(a, n - 1) * a;
} else {
long long b = binpow(a, n / 2);
return b * b;
}
}
void solve() {
int n, m, t;
cin >> n >> m >> t;
cout << ((n - m) * t + m - 1) / m;
}
int main() {
adskiy_razgon();
long long t = 1;
for (int i = 1; i <= t; ++i) {
solve();
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long gcd(long a, long b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int main() {
long long a, b, c, l, r, mid;
cin >> a >> b >> c;
l = 0;
r = 10000000;
while (l < r) {
mid = l + (r - l) / 2;
if (mid * b + c * b >= c * a)
r = mid;
else
l = mid + 1;
}
cout << l << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, n, k, a, b, c, v;
cin >> a >> b >> c;
v = a * c;
v -= b * c;
cout << (v - 1) / b + 1;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int x = b * c;
int y = a * c;
if (y <= x) {
cout << 0;
return 0;
}
if ((y - x) <= b)
cout << 1;
else {
if ((y - x) % b == 0)
cout << (y - x) / b;
else
cout << ((y - x) / b) + 1;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
scanf("%d%d%d", &a, &b, &c);
printf("%d\n", (a * c + b - 1) / b - c);
return 0;
}
|
#include <bits/stdc++.h>
int main() {
uint32_t a, b, c;
scanf("%d %d %d", &a, &b, &c);
printf("%g", ceil((double)(a * c - b * c) / b));
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, n = 0, a, b, c;
cin >> a >> b >> c;
n = a * c / b;
if (a * c % b != 0) n++;
cout << n - c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MAX = 50005;
const int inf = (1) << 30;
bool check(int res, int a, int b, int c) {
int tot = a * c;
int have = res * b;
for (int i = 1; i <= c; i++) {
have += b;
if (have < a * i) return false;
}
return true;
}
int main() {
int i, j, k, a, b, c;
while (scanf("%d%d%d", &a, &b, &c) != EOF) {
int res = 0;
int l = 0, r = (1 << 20), mid;
while (l <= r) {
mid = (l + r) >> 1;
if (check(mid, a, b, c)) {
res = mid;
r = mid - 1;
} else
l = mid + 1;
}
cout << res << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int solve(double a, double b, double c) {
int b2 = b;
a = a * c;
b = b * c;
double x = a - b;
return ceil(x / b2);
}
int main() {
long long bs[1000000 + 1];
for (int i = 0; i < 1000001; i++) {
bs[i] = i;
}
double a, b, c;
cin >> a >> b >> c;
int End = 1000000, start = 0;
while (End > start) {
int mid = (End - start) / 2 + (start);
if (bs[mid] < solve(a, b, c))
start = mid + 1;
else if (bs[mid] > solve(a, b, c))
End = mid - 1;
else
End = mid;
}
cout << start << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a <= b) {
cout << 0 << endl;
return 0;
}
int t0 = c * (a - b) / b;
if ((c * (a - b)) % b != 0) t0++;
cout << t0 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
template <typename T>
T binary_search(T lower_bound, T upper_bound, bool (*checker)(T)) {
T middle;
while (lower_bound < upper_bound) {
middle = (lower_bound + upper_bound) >> 1;
if ((*checker)(middle)) {
upper_bound = middle;
} else {
lower_bound = middle + 1;
}
}
return lower_bound;
}
bool checker(int num_secs_waited) { return (num_secs_waited + c) * b >= c * a; }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> a >> b >> c;
cout << binary_search(0, (a * c) / b + 10, checker);
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
int temp, x;
x = (a * c);
temp = (a * c) / b;
if (x % b == 0) {
temp = temp;
} else {
temp = temp + 1;
}
printf("%d\n", temp - c);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
if (b == 0) return a;
return gcd(b, a % b);
}
string toBin(long long a) {
string res = "";
while (a) {
res += char((a & 1) + '0');
a >>= 1;
}
reverse(res.begin(), res.end());
return res;
}
const int mod = 1e9 + 7;
long long expo(long long base, long long pow) {
long long ans = 1;
while (pow != 0) {
if (pow & 1 == 1) {
ans = ans * base;
ans = ans % mod;
}
base *= base;
base %= mod;
pow /= 2;
}
return ans;
}
long long inv(long long x) { return expo(x, mod - 2); }
bool isPal(string ss) {
int len = ss.length();
for (int i = 0; i < len / 2; i++) {
int comp = len - i - 1;
if (ss[i] != ss[comp]) return false;
}
return true;
}
double pi = 3.141592653589793238462643;
double error = 0.0000001;
const int M = 100001;
int main() {
int a, b, c;
scanf("%d", &(a));
scanf("%d", &(b));
scanf("%d", &(c));
int d = a * c;
int dx = (int)ceil((d * 1.0) / b);
int dy = (int)ceil((d * 1.0) / a);
int ans = dx - dy;
cout << max(ans, 0);
}
|
#include <bits/stdc++.h>
using namespace std;
float a, b, c, d, x, t;
long s;
int main() {
cin >> a >> b >> c;
a = a * c;
b = a / b;
if (int(b) < b)
s = int(b) + 1;
else
s = b;
if (s <= c)
cout << '0';
else
cout << s - c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int sz = 1e5;
bool isPrime[sz + 1];
bool iszero(int x) {
while (x != 0) {
int l = x % 10;
if (l == 0) {
return false;
}
x = x / 10;
}
return true;
}
void sieve() {
memset(isPrime, true, sizeof(isPrime));
isPrime[0] = isPrime[1] = false;
for (int i = 2; i * i <= sz; i++) {
if (isPrime[i]) {
for (int j = i * i; j < sz; j += i) {
isPrime[j] = false;
}
}
}
}
void findPrimesD(int d) {
int left = pow(10, d - 1);
int right = pow(10, d) - 1;
for (int i = left; i <= right; i++) {
if (isPrime[i]) {
if (iszero(i)) {
cout << i << endl;
break;
}
}
}
}
bool isPowerOfTwo(int n) {
if (n == 0) return false;
return (ceil(log2(n)) == floor(log2(n)));
}
bool isPerfectSquare(long double x) {
if (x >= 0) {
long long sr = sqrt(x);
return (sr * sr == x);
}
return false;
}
long long distance(int x1, int y1, int x2, int y2) {
long long ans = pow((x2 - x1), 2) + pow((y2 - y1), 2);
return ans;
}
int check(int x1, int y1, int x2, int y2, int x3, int y3) {
if ((x1 == x2 && y1 == y2) || (x1 == x3 && y1 == y3) ||
(x2 == x3 && y2 == y3))
return 0;
long long ans1 = distance(x1, y1, x2, y2);
long long ans2 = distance(x1, y1, x3, y3);
long long ans3 = distance(x2, y2, x3, y3);
if (ans1 + ans2 == ans3) return 1;
if (ans1 + ans3 == ans2) return 1;
if (ans2 + ans3 == ans1) return 1;
return 0;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(0);
long long a, b, c;
cin >> a >> b >> c;
float l, t;
l = (a - b) * c;
t = ceil(l / b);
cout << t;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
cin >> a >> b >> c;
int best = 0;
for (int i = 0; i < 1000000; i++) {
int end = i + c;
if (end * b >= a * c) {
best = i;
break;
}
}
cout << best << endl;
}
|
#include <bits/stdc++.h>
int vis[1000005];
int a, b, c;
int ff(int a, int b, int c, int wait) {
int lenth = a * c;
int lenth2 = (wait + c) * b;
if (lenth2 >= lenth)
return 1;
else
return 0;
}
int main() {
while (~scanf("%d%d%d", &a, &b, &c)) {
memset(vis, 0, sizeof(vis));
int le = 0, ri = 1000005, mid;
while (le <= ri) {
mid = (le + ri) / 2;
if (ff(a, b, c, mid) == 1)
ri = mid - 1;
else
le = mid + 1;
}
printf("%d\n", le);
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
printf("%d", a * c / b + ((a * c) % b == 0 ? 0 : 1) - c);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, ans;
cin >> a >> b >> c;
ans = ((a - b) * c + b - 1) / b;
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9;
const double PI = 2 * acos(0.0);
const double eps = 1e-9;
int dcmp(double a, double b) {
return (fabs(a - b) <= eps) ? 0 : ((a < b) ? -1 : 1);
}
int main() {
int a, b, c;
cin >> a >> b >> c;
if (cin.fail()) return 0;
for (int t = 0;; t++) {
int tot = t * b + c * b;
if (tot >= c * a) {
cout << t << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long a, b, c;
bool check(long long n) { return ((a * c + b - 1) / b - n <= c); }
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(0);
cin >> a >> b >> c;
long long l = -1;
long long r = 1e9;
while (l < r - 1) {
long long m = (l + r) / 2;
if (check(m))
r = m;
else
l = m;
}
cout << r;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int a, b, c, l, r, mid, i, j, k;
cin >> a >> b >> c;
l = 0;
r = 1000000000;
while (l <= r) {
mid = (l + r) / 2;
if ((mid + c) * b >= c * a) {
k = mid;
r = mid - 1;
} else
l = mid + 1;
}
cout << k << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-7;
const long long int m = 1000000007;
void solve() {
int own, dow, len;
cin >> own >> dow >> len;
own -= dow;
own *= len;
if (own % dow)
cout << own / dow + 1 << '\n';
else
cout << own / dow << '\n';
return;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t = 1;
while (t--) {
solve();
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int data_req = a * c;
int time = data_req / b;
time = time - c;
if (data_req % b == 0) {
cout << time;
} else {
cout << time + 1 << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long INFL = LLONG_MAX;
int main() {
long long a, b, c;
ios_base::sync_with_stdio(0);
cin >> a >> b >> c;
long long up = (a - b) * c;
if (up % b == 0)
cout << up / b << endl;
else
cout << (up / b) + 1 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
int main() {
ios_base ::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int a, b, c;
cin >> a >> b >> c;
int needed = (a * c) - (b * c);
if (needed % b == 0) {
cout << needed / b;
} else {
cout << (needed / b) + 1;
}
return 0;
}
|
#include <bits/stdc++.h>
int a, b, c;
int main() {
scanf("%d %d %d", &a, &b, &c);
int answer;
for (answer = 0;; answer++) {
if (b * (answer + c) >= a * c) break;
}
printf("%d\n", answer);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e3 + 5;
const long long modulo = 1000000007;
const double pi = 3.14159;
template <class T>
ostream &operator<<(ostream &out, vector<T> &A) {
for (auto x : A) out << x << " ";
return out;
}
template <class T>
ostream &operator<<(ostream &out, set<T> &A) {
for (auto x : A) out << x << " ";
return out;
}
template <class T>
ostream &operator<<(ostream &out, unordered_set<T> &A) {
for (auto x : A) out << x << " ";
return out;
}
long long mceil(long long a, long long b) {
if (a % b == 0)
return a / b;
else
return a / b + 1;
}
void solve() {
long long a, b, c;
cin >> a >> b >> c;
long long x = a * c;
long long y = mceil(x, b);
for (long long i = 0; i <= y; i++) {
long long s = i * b;
long long v = s / a;
long long tt = c - v;
if (x - (s + v * b) <= b * tt) {
cout << i;
return;
}
}
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
bool flag = true;
cin >> a >> b >> c;
for (int t = 0;; t++) {
flag = true;
for (int t0 = t; t0 <= c + t; t0++) {
if (!(b * t0 >= a * (t0 - t))) {
flag = false;
break;
}
}
if (flag) {
cout << t;
return 0;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int INF = 100000000;
double EPS = 1e-8;
int main() {
double a, b, c;
cin >> a >> b >> c;
cout << ceil(c * (a - b) / b) << endl;
return 0;
}
|
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int INF = int(1e9), mod = 10056, N = int(1e6) + 5;
int a, b, c;
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> a >> b >> c;
a *= c;
int l = 1;
int r = a;
while (l <= r) {
int mid = (l + r) / 2;
if (mid * b + c * b >= a) {
r = mid - 1;
} else {
l = mid + 1;
}
}
cout << l;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a, b, c;
cin >> a >> b >> c;
int rel_vel = a - b;
int dis = c * rel_vel;
int ti = ceil(dis / (b * 1.0));
cout << ti;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, t, k;
while (cin >> a >> b >> c) {
t = a * c;
if (t % b == 0)
k = t / b;
else
k = t / b + 1;
cout << k - c << endl;
}
}
|
#include <bits/stdc++.h>
int main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
int ini = 0, fim = (a * c + 1) / b;
int resp = 0;
for (int i = 0; i <= fim + 1; i++) {
int time = i * b + b * c;
if (time >= a * c) {
resp = i;
break;
}
}
printf("%d\n", resp);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int v1, v2, t;
cin >> v1 >> v2 >> t;
int v = v1 - v2;
int answer = 0;
if (v > 0) {
answer = t * v / v2;
if ((t * v) % v2 > 0) answer++;
}
cout << answer;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
cin >> a >> b >> c;
double ans = max((a - b) / b, c * (a - b) / b);
printf("%d\n", max(0, (int)ceil(ans)));
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
a *= c;
a -= b * c;
if (a % b == 0)
cout << a / b;
else
cout << a / b + 1;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int a, b, c;
cin >> a >> b >> c;
int l = 1, r = a * c;
int sol = INT_MAX, ans = -1;
while (l <= r) {
int mid = l + (r - l) / 2;
int cost = mid * b + (c * b);
if (cost > a * c) {
r = mid - 1;
if (cost < sol) {
sol = cost, ans = mid;
}
} else if (cost < a * c) {
l = mid + 1;
} else {
ans = mid;
break;
}
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
scanf("%d %d %d", &a, &b, &c);
printf("%d\n", ((a - b) * c - 1) / b + 1);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int d2x[] = {1, -1, 0, 0, 1, -1, 1, -1};
int d2y[] = {0, 0, 1, -1, 1, -1, -1, 1};
int d3x[] = {1, -1, 0, 0, 0, 0};
int d3y[] = {0, 0, 1, -1, 0, 0};
int d3z[] = {0, 0, 0, 0, 1, -1};
struct edge {
int from, to, w;
edge(int from, int to, int w) : from(from), to(to), w(w) {}
bool operator<(const edge& e) const { return w > e.w; }
};
const double EPS = (1e-9);
int a, v, c, data;
bool p(int val);
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
;
cin >> a >> v >> c;
data = a * c;
int low = 0, high = 1000003, mid;
while (low < high) {
mid = (low + high) / 2;
if (p(mid)) {
high = mid;
} else {
low = mid + 1;
}
}
cout << low << endl;
return 0;
}
bool p(int val) {
int t = (data - val * v) / v + ((data - val * v) % v != 0);
return (val * v + v * t >= data && val * v + v * t >= a * t);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.