text stringlengths 49 983k |
|---|
#include <bits/stdc++.h>
using namespace std;
long long a, b, c, l, r, m;
bool can(int m) {
double w, t;
w = m * b;
w = w * c;
t = a - b * c;
w /= t;
if (w >= c)
return true;
else
return false;
}
int main() {
cin >> a >> b >> c;
a *= c;
l = 0;
r = 1000000;
while (l + 1 < r) {
m = (l + r) / 2;
if (can(m))
r = m;
else
l = m;
}
if (can(l)) r = l;
cout << r << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << ceil(float(a * c) / float(b)) - c;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 1e9;
int a, b, c;
bool ok(long long mid) {
long long data, sum = 0;
data = a * c;
sum = b * c + mid * b;
return sum >= data;
}
int main() {
int l = 0, h = N, mid;
cin >> a >> b >> c;
while (h > l) {
mid = ((h + l) >> 1);
if (ok(mid)) {
h = mid;
} else {
l = mid + 1;
}
}
cout << h << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, l, r, t;
cin >> a >> b >> c;
l = 0;
r = c * a / b;
while (l <= r) {
bool f = 1;
t = (l + r) / 2;
for (int i = 1; i <= c; i++)
if (t * b + i * b < i * a) {
f = 0;
}
if (f == 1) r = t - 1;
if (f == 0) l = t + 1;
}
cout << l << endl;
}
|
#include <bits/stdc++.h>
int main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
int extra = a * c - b * c;
int t = extra / b;
if (extra % b != 0) {
t++;
}
printf("%d\n", t);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
signed main() {
cin.tie(0)->sync_with_stdio(0);
long long a, b, c;
cin >> a >> b >> c;
long long lo = 0, hi = 1e9;
auto check = [&](long long x) {
long long recv = x * b;
for (long long i = x; i <= x + c; i++) {
long long need = (i - x) * a;
if (need > recv) {
return 0;
}
recv += b;
}
return 1;
};
while (lo < hi) {
long long mid = (lo + hi) / 2;
if (check(mid))
hi = mid;
else
lo = mid + 1;
}
cout << lo << "\n";
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9 + 7;
const long long LINF = INF * 1LL * INF;
const int MAXN = 100500;
const double EPS = 1e-5;
int a, b, c;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> a >> b >> c;
int top = (a * c + b - 1) / b;
for (int i = 1; i <= top; ++i)
if ((i + c) * b >= a * c) {
cout << i;
break;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
bool cheak(long long x) {
if (x * b + b * c >= c * a) return true;
return false;
}
int main() {
scanf("%d%d%d", &a, &b, &c);
long long l = 0, r = 1e9, ans = 1e7;
while (l <= r) {
if (cheak((l + r) / 2)) {
ans = min(ans, (l + r) / 2);
r = (l + r) / 2 - 1;
} else
l = (l + r) / 2 + 1;
}
printf("%d", ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int area;
struct node {
int st, ed;
int cnt;
int f;
node *l, *r;
node() {}
node(int _x, int _y) {
st = _x, ed = _y;
l = r = NULL;
cnt = 0;
}
};
void insert(node *ob, int val, int ind) {
if (ob->st == ob->ed) {
ob->cnt += val;
ob->f = ind;
return;
}
int mid = (ob->st + ob->ed) / 2;
if (ob->l == NULL) ob->l = new node(ob->st, mid);
if (ob->r == NULL) ob->r = new node(mid + 1, ob->ed);
if (mid >= ind) {
insert(ob->l, val, ind);
} else
insert(ob->r, val, ind);
if (ob->l->cnt > ob->r->cnt) {
ob->cnt = ob->l->cnt;
ob->f = ob->l->f;
} else {
ob->cnt = ob->r->cnt;
ob->f = ob->r->f;
}
return;
}
int A;
int L;
int waste;
char str[20];
bool state;
char ch;
void query(node *ob, int val) {
if (ob == NULL) return;
if (state) return;
if (ob->cnt < val) return;
if (ob->st == ob->ed) {
if (ob->cnt >= val) {
A = ob->f;
state = true;
return;
}
}
if (ob->l->cnt >= val)
query(ob->l, val);
else if (ob->r->cnt >= val)
query(ob->r, val);
else
return;
}
int main() {
int a, b, c, p, q, ans;
cin >> a >> b >> c;
int i, j, k;
int wait, total, lage, ase;
total = a * c;
for (i = 0;; i++) {
p = i * b;
int baki = total - p;
int hoy = (i + c) * b;
if (hoy < total)
continue;
else {
cout << i << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, f, g;
cin >> m >> n >> f;
if (n >= m) {
cout << 0;
return 0;
}
g = f * m - f * n;
f = g / n;
if (f * n < g) f++;
cout << f;
}
|
#include <bits/stdc++.h>
using namespace std;
long long min(long long a, long long b) {
if (a > b)
return b;
else
return a;
}
bool possible(long long t, long long a, long long b, long long c) {
long long down, need = 0;
down = t * b;
for (int i = 0; i <= c; i++) {
if (need > down)
return false;
else {
need += a;
down += b;
}
}
return true;
}
int main() {
long long a, b, c;
cin >> a >> b >> c;
long long ans = 10000000;
long long start = 1, end = 1000000, mid;
while (start <= end) {
mid = (start + end) / 2;
if (possible(mid, a, b, c)) {
ans = min(ans, mid);
end = mid - 1;
} else
start = mid + 1;
if (start == mid) {
ans = min(ans, mid);
break;
}
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n, m, k, a, b, l, z, x_before;
long long start, end1, mid, sum = 0;
vector<long long> v1;
vector<long long> v2;
long long arr[9999999];
int main(int argc, char** argv) {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m >> k;
start = 1;
end1 = n * k;
while (start != end1) {
long long mid = (start + end1) / 2;
long long x = m * (mid + k);
if (x >= (k * n)) {
end1 = mid;
} else {
start = mid + 1;
}
}
cout << end1 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
cin >> a >> b >> c;
cout << (int)ceil(c * (a - b) / b);
}
|
#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, e;
int main() {
cin >> a >> b >> c;
cout << ((a * c + b - 1) / b) - c;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
int t = (a - b) * c / b;
if ((a - b) * c % b != 0) ++t;
printf("%d\n", t);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
int a, b, c;
cin >> a >> b >> c;
int data = c * a;
int kitna = b * c;
int bacha = data - kitna;
int ans = bacha / b + (bacha % b != 0);
cout << ans << endl;
}
signed main() {
ios_base::sync_with_stdio(false), cin.tie(NULL);
solve();
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
cin >> a >> b >> c;
double data = a * c;
double all = a * c / b;
int wait = int(all) - int(c);
if (all > int(all)) wait++;
cout << wait << endl;
}
|
#include <bits/stdc++.h>
int a, b, c;
int t, x = 0;
int ans = 0;
void find(int x) {
for (t = x; t <= c + x; t++)
if (b * x + (b - a) * (t - x) < 0) {
x++;
ans++;
find(x);
break;
}
}
int main() {
scanf("%d%d%d", &a, &b, &c);
find(x);
printf("%d\n", ans);
return 0;
}
|
#include <bits/stdc++.h>
using ll = long long;
int main() {
int a, b, c;
std::cin >> a >> b >> c;
int mt = (a * c + b - 1) / b;
for (int t = 0; t <= mt; t++) {
int rest = a * c - b * t;
int rt = (rest + b - 1) / b;
bool isPause = false;
for (int tt = 0; tt <= rt; tt++) {
int load = a * tt;
int download = b * (t + tt);
if (load > download) {
isPause = true;
break;
}
}
if (!isPause) {
std::cout << t << std::endl;
return 0;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int zhdan = 0;
while (true) {
if ((zhdan + c) * b >= a * c) {
cout << zhdan << endl;
return 0;
}
zhdan++;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if ((a * c) % b != 0)
cout << (((a * c) / b) - c) + 1;
else
cout << ((a * c) / b) - c;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
for (int Ans = 0;; Ans++) {
int have = b * Ans;
int flag = 1;
for (int k = 1; k <= c; k++) {
have += b - a;
if (have < 0) {
flag = 0;
break;
}
}
if (flag == 1) {
cout << Ans << endl;
return 0;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, d;
while (cin >> a >> b >> c) {
d = a * c - b * c;
if (d % b == 0)
cout << d / b << endl;
else
cout << d / b + 1 << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxx = 5;
const int mod = 1000000007LL;
const long long inf = 1e9 + 7;
int32_t main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int a, b, c;
cin >> a >> b >> c;
int i = 1;
while ((c + i) * b < a * c) i++;
cout << i;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int lim = 1e6 + 6;
const int mod = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int a, b, c;
cin >> a >> b >> c;
int lo = 0, hi = 2000000;
while (lo < hi) {
int mid = (lo + hi) / 2;
int load = mid * b;
if (load / (a - b) >= c)
hi = mid;
else
lo = mid + 1;
}
cout << lo;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
float a, b, c;
cin >> a >> b >> c;
cout << ceil((c * (a - b)) / b);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long a, b, c;
int main() {
ios::sync_with_stdio(NULL);
cin.tie(NULL);
cin >> a >> b >> c;
if (a <= b) return cout << 0, 0;
long long ans = 0;
for (long long l = 0, r = a * c, mid = 0; l < r;) {
mid = (l + r) >> 1;
if (a * c <= b * (mid + c)) {
r = mid;
ans = mid;
} else
l = mid + 1;
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int a{};
long long int b{};
long long int c{};
double z{};
long long int s{};
long long int e{};
double d{};
cin >> a >> b >> c;
if (a - b == c * b)
cout << a - b;
else {
z = (static_cast<double>((a * c) - (b * c))) / (static_cast<double>(b));
s = ((a * c) - (b * c)) / b;
d = static_cast<double>(s);
if (z > d) {
e = static_cast<int>(z);
cout << s + 1;
} else {
cout << s;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a[1000];
int l[1000];
int main() {
int a, b, c;
while (cin >> a >> b >> c) {
int d = a * c - b * c;
if (d % b == 0)
cout << d / b << endl;
else
cout << d / b + 1 << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
cin >> a >> b >> c;
int t;
t = (a - b) * c / b;
t += ((a - b) * c % b == 0) ? 0 : 1;
cout << t << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3fll;
const double DINF = 1.0 / 0.0f;
const double pi = acos(-1.0);
const double eps = 1e-8;
inline int LC(int x) { return x << 1; }
inline int RC(int x) { return (x << 1) | 1; }
inline bool eq0(double x) { return fabs(x) < eps; }
inline bool eq(double x, double y) { return fabs(x - y) < eps; }
inline bool ls(double x, double y) { return x + eps < y; }
inline bool gr(double x, double y) { return x - eps > y; }
inline bool greq(double x, double y) { return x + eps >= y; }
inline bool lseq(double x, double y) { return x - eps <= y; }
inline double fmax(double x, double y) { return gr(x, y) ? x : y; }
inline double fmin(double x, double y) { return ls(x, y) ? x : y; }
template <class T>
inline T sqr(T x) {
return x * x;
}
int main() {
int a, b, c;
while (cin >> a >> b >> c) {
cout << a * c / b + (a * c % b != 0) - c << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
const long long int N = 1000005;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long int t, i, j, k;
t = 1;
while (t--) {
long long int a, b, c;
cin >> a >> b >> c;
long long int lo = 0;
long long int hi = 1e10;
long long int ans = 1e10;
while (lo <= hi) {
long long int mi = (lo + hi) / 2;
long long int val = mi * b + c * b;
if (val >= c * a) {
ans = min(ans, mi);
hi = mi - 1;
} else
lo = mi + 1;
}
cout << ans;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, p, k;
cin >> a >> b >> c;
p = a * c;
k = p / b;
if (p % b > 0) ++k;
cout << k - c;
}
|
#include <bits/stdc++.h>
int ceil_div(int num, int d) { return (num + d - 1) / d; }
int main() {
int a, b, c;
std::scanf("%d%d%d", &a, &b, &c);
std::printf("%d\n", ceil_div(a * c, b) - c);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
int n = a * c;
int m = b * c;
m = n - m;
if (m % b == 0)
m = m / b;
else
m = m / b + 1;
printf("%d\n", m);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int ans = 1;
for (int i = 1; i <= 1e6; ++i) {
int k = (a * c - i * b);
if (k % b != 0)
k = k / b + 1;
else
k /= b;
if (k == c) {
ans = i;
break;
}
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-7;
int main() {
int a, b, c, i, j, k, l, t, data, rdata, v;
scanf("%d%d%d", &a, &b, &c);
t = a * c;
k = 1;
while (k) {
data = b * k;
v = 0;
for (i = 1; i <= c; i++) {
data += b;
if (data < a) break;
data -= a;
v += a;
}
if (v >= t) break;
k++;
}
printf("%d\n", k);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int l = 1, h = a * c, mid, ans;
while (l <= h) {
mid = l + (h - l) / 2;
int temp = mid / b;
if (temp * b + (b * c) < a * c)
l = mid + 1;
else {
ans = temp;
h = mid - 1;
}
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int m = ceil((a * c) / float(b));
cout << m - c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long a, b, c;
int main() {
cin >> a >> b >> c;
cout << ceil((double)a * c / b) - c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long N, A, B;
long long All;
bool MySort(const pair<int, int>& A, const pair<int, int>& B) {
return A.first > B.first;
}
bool Check(long long M) {
long long X = M * A;
X += (A * B);
if (X < All) return false;
return true;
}
int main() {
cin >> N >> A >> B;
All = N * B;
long long L = 1, R = 1e8;
long long Ans = 1e8;
while (R >= L) {
long long M = (R + L) / 2;
if (Check(M)) {
Ans = min(Ans, M);
R = M - 1;
} else {
L = M + 1;
}
}
cout << Ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ldb = long double;
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
void solve() {
ll a, b, c;
cin >> a >> b >> c;
ll size = a * c;
ll l = 0, r = 1e9, res = 0;
while (l <= r) {
ll mid = (l + r) / 2;
ll wait = mid * b;
ll thing = size - wait;
if ((thing) % b != 0)
thing = thing / b + 1;
else
thing /= b;
if (thing <= c) {
res = mid;
r = mid - 1;
} else
l = mid + 1;
}
cout << res;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
solve();
}
|
#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream& operator<<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator<<(ostream& out, const array<T, N>& a) {
out << "[";
bool first = true;
for (auto& v : a) {
out << (first ? "" : ", ");
out << v;
first = 0;
}
out << "]";
return out;
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
out << "[";
bool first = true;
for (auto& v : a) {
out << (first ? "" : ", ");
out << v;
first = 0;
}
out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator<<(ostream& out, const set<T, Cmp>& a) {
out << "{";
bool first = true;
for (auto& v : a) {
out << (first ? "" : ", ");
out << v;
first = 0;
}
out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator<<(ostream& out, const map<U, T, Cmp>& a) {
out << "{";
bool first = true;
for (auto& p : a) {
out << (first ? "" : ", ");
out << p.first << ":" << p.second;
first = 0;
}
out << "}";
return out;
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int a, b, c;
cin >> a >> b >> c;
cout << ((a * c + b - 1) / b) - c << "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a, b, c, d = 0, f = 0, x, y, flag = 0;
cin >> a >> b >> c;
x = a * c;
y = b * c;
if ((x - y) % b == 0) flag = 1;
for (;;) {
f = f + b;
if (f <= (x - y)) {
d++;
} else
break;
}
if (flag == 1)
cout << d;
else
cout << d + 1;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
while (cin >> a >> b >> c) {
long long l = 0, r = 100000000;
while (l <= r) {
long long t = (l + r) / 2;
long long w = b * t;
long long d = b * t;
bool ok = true;
while (d < a * c) {
if (w < a) {
ok = false;
break;
}
w -= a;
w += b;
d += b;
}
if (ok)
r = t - 1;
else
l = t + 1;
}
cout << l - 1 << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int a, b, c;
int denom, numer;
scanf("%d %d %d", &a, &b, &c);
denom = a * b;
numer = (a - b) * (c * a);
if (numer % denom == 0) {
printf("%d\n", numer / denom);
} else {
printf("%d\n", numer / denom + 1);
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int t = a * c;
if (t % b == 0)
cout << t / b - c;
else
cout << t / b - c + 1;
a++;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
while (cin >> a >> b >> c) {
int i;
for (i = 0; i < a * c / b; ++i)
if (c * a <= (c + i) * b) break;
cout << i << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int main() {
long long res;
int a, b, c;
cin >> a >> b >> c;
int l = ceil(double(a * c) / double(b) - double(c));
if (l < 0)
cout << "0";
else
cout << l;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool debug = false;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
int main() {
int a, b, c;
cin >> a >> b >> c;
k = (a - b) * c;
printf("%d\n", k % b == 0 ? k / b : k / b + 1);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, ans, ans1;
cin >> a >> b >> c;
ans = (a * c) - (b * c);
ans1 = ans / b;
if (ans % b == 0)
cout << ans1;
else
cout << ans1 + 1;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
while (cin >> a >> b >> c) {
for (int t = 1; t <= 10000000; t++) {
bool chk = true;
for (int t0 = t; t0 <= (t + c); t0++) {
int tmp = t0 - t;
tmp = ((tmp > 0) ? tmp : 0);
if ((b * t0) < (a * tmp)) {
chk = false;
break;
}
}
if (chk) {
cout << t << endl;
break;
}
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
bool ok(int x) {
if (((a * c) - (b * c) + b - 1) / b > x)
return false;
else
return true;
}
int binarySearch() {
int lo = 0, med, h = 1000000;
while (lo < h) {
med = (lo + h) >> 1;
if (ok(med))
h = med;
else
lo = med + 1;
}
return lo;
}
int main() {
cin >> a >> b >> c;
cout << binarySearch();
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() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
double a, b, c;
cin >> a >> b >> c;
a *= c;
cout << ceil(max(a / b - c, 0.0));
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long a, b, c;
int main() {
ios_base::sync_with_stdio(0), cin.tie(), cout.tie();
;
cin >> a >> b >> c;
cout << (c * a + b - 1) / b - c;
}
|
#include <bits/stdc++.h>
int main() {
int a, b, c;
int n;
scanf("%d %d %d", &a, &b, &c);
n = a * c - b * c;
if (n <= 0) {
printf("0");
} else {
if (n % b == 0) {
n /= b;
} else {
n /= b;
n++;
}
printf("%d", n);
}
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
cin >> a >> b >> c;
int ans = (a * c) / b - c;
if ((a * c) % b != 0) ans++;
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, point = 0;
cin >> a >> b >> c;
for (int second = 1;; second++) {
point += b;
if (point + b * c >= a * c) {
cout << second;
return 0;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int ans = (a * c) / b;
if ((a * c) % b) ans++;
cout << ans - (c) << endl;
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) / b) + 1, 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() {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
int n = a * c - b * c;
if (n % b > 0)
printf("%d\n", n / b + 1);
else
printf("%d\n", n / b);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pi = pair<int, int>;
int a, b, c;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> a >> b >> c;
int temp = (a - b) * c;
cout << ceil((double)temp / b) << '\n';
}
|
#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);
}
long long pmod(long long n, long long a, long long m) {
long long ans = 1;
long long k = n;
while (a) {
if (a % 2 == 1) {
ans = ((ans % m) * (k % m)) % m;
}
k = ((k % m) * (k % m)) % m;
a /= 2;
}
return ans;
}
void solve() {
long long mod = 1e+9;
mod += 7;
long long a, b, c;
cin >> a >> b >> c;
long long u = a * c - b * c;
long long k = u / b;
if (u % b != 0) k++;
cout << k;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int tc = 1;
while (tc--) {
solve();
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int tt = a * c;
int tmp;
for (int i = 1; i <= tt; i++) {
tmp = i * b;
tmp = tmp + c * b;
if (tmp >= tt) {
printf("%d\n", i);
return 0;
}
}
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 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() {
ios_base ::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int a, b, c, k;
cin >> a >> b >> c;
k = (a * c) / b;
if ((a * c) % b) k++;
cout << k - c;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
while (cin >> a >> b >> c) {
int ans = ceil(double((a - b) * c) / b);
cout << ans << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, k, a, b, c, t;
cin >> a >> b >> c;
t = 1;
i = a * c;
j = 0;
while (t > 0) {
k = j * b + c * b;
if (k >= i)
t = 0;
else
j = j + 1;
}
cout << j;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int m, n;
int a, b, c;
int main() {
while (scanf("%d%d%d", &a, &b, &c) != EOF) {
int ha = a * c;
int ha1 = b * c;
int ha2 = (ha - ha1) / b;
if ((ha - ha1) % b != 0) ha2++;
cout << ha2 << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
cin >> a >> b >> c;
int needed_data = a * c;
int formed_data_during_video = b * c;
needed_data -= formed_data_during_video;
int max_weight = float(needed_data) / float(b) > float(needed_data / b)
? needed_data / b + 1
: needed_data / b;
cout << max_weight;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long a, b, c;
cin >> a >> b >> c;
long long t = (c * a + b - 1) / b;
cout << t - c << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, n;
scanf("%d %d %d", &a, &b, &c);
n = a * c - (b * c);
if (n % b == 0)
printf("%d\n", n / b);
else
printf("%d\n", (n / b) + 1);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, res;
cin >> a >> b >> c;
res = (a - b) * c;
if (res % b == 0)
cout << res / b << endl;
else
cout << res / b + 1 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
if (!b) return a;
return gcd(b, a % b);
}
long long power(long long x, long long y, long long p) {
long long res = 1;
x %= p;
while (y > 0) {
if (y & 1) res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
{
long long a, b, c;
cin >> a >> b >> c;
long long temp = a * c - (b * c);
temp = ceil(temp / double(b));
cout << temp << "\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, c, v, l, ans;
scanf("%d%d%d", &c, &v, &l);
if (c * l % v == 0)
ans = c * l / v;
else
ans = c * l / v + 1;
printf("%d\n", ans - l);
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int a, b, c;
int res = 0;
scanf("%d %d %d", &a, &b, &c);
bool found = false;
while (!found) {
int data = res * b;
int t0;
for (t0 = res; t0 <= res + c; t0++) {
if (data < (t0 - res) * a) {
res++;
break;
} else {
data += b;
}
}
if (t0 == res + c + 1) found = true;
}
printf("%d", res);
}
|
#include <bits/stdc++.h>
using namespace std;
long double a, b, c, theta, tot;
long long st, en, mid, last;
bool check() {
tot = 0.0;
long double now = mid * b / a;
int cnt = 0;
while (cnt <= 100000) {
tot += now;
if (tot + 0.000000001 > c) return true;
now = now * theta;
cnt++;
}
return false;
}
int main() {
cin >> a >> b >> c;
st = 0, en = c * a;
theta = b / a;
check();
while (st <= en) {
mid = (st + en) / 2;
if (check()) {
last = mid;
en = mid - 1;
} else
st = mid + 1;
}
cout << last << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int sum = c * a;
int p = 0;
while (1) {
if (p * b + c * b >= sum) {
cout << p;
break;
}
p++;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int solve(int watps, int dowps, int tlength) {
if (watps <= dowps) return 0;
int start = 0;
int end = (watps * tlength) / dowps;
int res = 0;
while (start <= end) {
int mid = start + (end - start) / 2;
if (watps * tlength == dowps * (tlength + mid))
return mid;
else if (watps * tlength < dowps * (tlength + mid)) {
res = mid;
end = mid - 1;
} else
start = mid + 1;
}
return res;
}
int main() {
int watps, dowps, tlength;
cin >> watps >> dowps >> tlength;
int ans = solve(watps, dowps, tlength);
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
float a, b, c;
cin >> a >> b >> c;
cout << ceil((a * c - b * c) / b);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool isPrime(int n) {
if (n == 1) {
return false;
}
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) return false;
}
return true;
}
int power(int x, unsigned int y, int p) {
int res = 1;
x = x % p;
if (x == 0) return 0;
while (y > 0) {
if (y & 1) res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
long long int findSubarraySum(long long int arr[], long long int n,
long long int sum) {
unordered_map<int, int> prevSum;
long long int res = 0;
long long int currsum = 0;
for (long long int i = 0; i < n; i++) {
currsum += arr[i];
if (currsum == sum) res++;
if (prevSum.find(currsum - sum) != prevSum.end())
res += (prevSum[currsum - sum]);
prevSum[currsum]++;
}
return res;
}
int main() {
float a, b, c;
cin >> a >> b >> c;
float dif = (a * c) - (b * c);
float d = b;
cout << ceil(dif / b);
}
|
#include <bits/stdc++.h>
const double pi = 3.1415926535897932384626433832795;
int gcd(int a, int b) {
if (a == 0) return b;
return gcd(b % a, a);
}
using namespace std;
void ifd() {}
void tme() {}
int a, b, c;
int main() {
ifd();
cin >> a >> b >> c;
cout << ((a - b) * c + b - 1) / b << endl;
tme();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int t = 1;
while (t--) {
int a, b, c;
cin >> a >> b >> c;
if (a * c % b == 0)
cout << a * c / b - c;
else
cout << a * c / b + 1 - c;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
bool ok(int x, int t) {
if (t * b >= (t - x) * a) return 1;
return 0;
}
int main() {
cin >> a >> b >> c;
int x = (a * c) / b;
int l = 1, r = (c * a + b - 1) / b, t = r, ll;
while (l <= r) {
int m = (l + r + 1) / 2;
if (ok(m, t)) {
ll = m;
r = m - 1;
} else
l = m + 1;
}
cout << ll;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int ans = (1LL << 30) - 1LL;
long long int a, b, c;
cin >> a >> b >> c;
long long int all_need = c * a;
for (int k = 29; k >= 0; --k) {
long long int wt = ans ^ (1LL << k);
long long int no_int = 1LL;
long long int dw = (wt * b);
long long int dn = a;
while (true) {
if (dw >= all_need) break;
if (dn > dw) {
no_int = 0LL;
break;
}
dw += b;
dn += a;
}
ans ^= (no_int) << k;
}
cout << max(ans - 1LL, 1LL) << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, a, b, c, Res, download;
while (cin >> a >> b >> c) {
download = a * c;
Res = download / b;
if (download % b != 0) Res++;
cout << Res - c << "\n";
}
return 0;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int fx[4][2] = {{0, 1}, {-1, 0}, {0, -1}, {1, 0}};
const int fxx[9][2] = {{0, 0}, {0, 1}, {0, -1}, {1, 0}, {-1, 0},
{1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
void subsequences(long long ar[], long long n);
long long apow(long long a, long long b);
long long bpow(long long a, long long b, long long mod);
bool dio(long long a, long long b, long long c);
bool palindrome(string s);
void sieve();
long long binarySearch(vector<long long> vec, long long n, long long x);
long long kadane(vector<long long> vec, long long n);
vector<long long> factors(long long n);
long long countBits(long long n);
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long a, b, c;
cin >> a >> b >> c;
long long m = a * c;
long long n = b * c;
cout << ceil((double)(m - n) / b);
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int a, b, c, k;
scanf("%d%d%d", &a, &b, &c);
k = ((a - b) * c + b - 1) / b;
printf("%d\n", k);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
cin >> a >> b >> c;
cout << ceil((a * c - b * c) / b) << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int ans = c * (a - b);
cout << ceil((double)ans / (double)b) << "\n";
}
|
#include <bits/stdc++.h>
int main() {
int a, b, c, sum, i, j;
scanf("%d %d %d", &a, &b, &c);
sum = a * c;
for (i = 1; i <= sum / b; ++i) {
j = sum - i * b;
if (b * c >= j) {
break;
}
}
printf("%d\n", i);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
cin >> a >> b >> c;
double ans = ceil((a * c) / b - c);
if (ans < 0) ans = 0;
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, c;
long long b;
cin >> a >> b >> c;
double x = a * c;
x = x / b;
long long ans = ceil(x) - c;
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int a, b, c;
cin >> a >> b >> c;
int l = 1, h = 100000000, m;
while (l <= h) {
m = (l + h) / 2;
if (c * (a - b) > m * b)
l = m + 1;
else if (c * (a - b) <= m * b && c * (a - b) > (m - 1) * b)
break;
else if (c * (a - b) < m * b)
h = m - 1;
else
break;
}
cout << m;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << ((a - b) * c + (b - 1)) / b;
}
|
#include <bits/stdc++.h>
using namespace std;
long long mi = 2e9;
long long ma = -2 * 1e9;
const int N = 1e5 + 5;
int main() {
std::ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
double a, b, c;
cin >> a >> b >> c;
double x = c * a, y = 0, z = ceil((x - y) / b);
while (z > c) {
y += b;
z = ceil((x - y) / b);
if (x - y < y && z < c) break;
}
cout << y / b;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c, t, k;
cin >> a >> b >> c;
t = a * c;
t = t - b * c;
k = t / b;
if (t % b != 0) k++;
cout << k << endl;
}
|
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long int MOD = 1000000007;
double eps = 1e-12;
vector<vector<long long int>> mat(1001, vector<long long int>(1001, 0));
vector<vector<bool>> vis(1001, vector<bool>(1001, false));
void solve() {
float a, b, c;
cin >> a >> b >> c;
if ((int)a < (int)b)
cout << "0";
else {
int tot = ceil(c * a / b);
cout << tot - (int)c;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t = 1;
while (t--) {
solve();
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int q = a * c / b;
if (q * b != a * c) {
q++;
}
cout << q - c;
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.