text stringlengths 49 983k |
|---|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int v = v0;
int ctr = 1;
while (c > 0) {
c -= v;
if (ctr != 1) c += l;
if (c <= 0) {
cout << ctr << '\n';
return 0;
}
++ctr;
v += a;
if (v > v1) v = v1;
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int c, v, v1, a, l, nd = 0, rc = 0;
scanf("%d%d%d%d%d", &c, &v, &v1, &a, &l);
while (rc <= c) {
if (v + (nd * a) <= v1) {
rc = rc + v + (nd * a);
nd++;
if (rc >= c) break;
rc = rc - l;
} else {
rc = rc + v1;
nd++;
if (rc >= c) break;
rc = rc - l;
}
}
printf("%d", nd);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l, sum = 0, sum1, cont = 0, i = 0;
scanf("%d %d %d %d %d", &c, &v0, &v1, &a, &l);
while (sum < c) {
sum1 = v0 + (a * i);
if (sum1 < v1) {
cont++;
sum += sum1;
if (i != 0) {
sum -= l;
}
} else {
sum += v1;
cont++;
if (i != 0) {
sum -= l;
}
}
i++;
}
printf("%d", cont);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int days = 0;
while (c > 0) {
c -= min(v1, v0 + a * days) - l * bool(days);
days++;
}
cout << days;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
int ans = 1;
int p = 0;
cin >> c >> v0 >> v1 >> a >> l;
p = v0;
while (p < c) {
ans++;
p -= l;
if (v0 + a * (ans - 1) > v1)
p += v1;
else
p += v0 + a * (ans - 1);
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int days = 1;
int page = v0;
while (true) {
if (page >= c) break;
page -= l;
int read = min(v0 + days * a, v1);
page += read;
days++;
}
cout << days << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, first, max, add, r, day = 1, ye = 0, su = 0;
scanf("%d %d %d %d %d", &n, &first, &max, &add, &r);
if (first >= n) {
printf("%d\n", day);
return 0;
}
ye = first;
su = first;
for (;;) {
su += add;
if (su > max) su = max;
ye += su - r;
day++;
if (ye >= n) {
printf("%d\n", day);
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int c, v0, v1, a, l, count, sum, pr, totalread = 0, days = 0;
cin >> c >> v0 >> v1 >> a >> l;
count = c;
sum = 0;
while (count > 0) {
pr = v0 + sum;
if (pr > v1) pr = v1;
count = count - pr;
if (days != 0) {
count = count + l;
}
sum = sum + a;
days++;
}
cout << days;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int all, one, more, maxs, last;
cin >> all >> one >> maxs >> more >> last;
int days = 0, see = 0;
while (true) {
see += one;
days++;
if (see >= all) break;
see -= last;
one = min(maxs, one + more);
}
cout << days << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long x, y, z;
string s1, s2, s;
void memset_ll(long long a[], long long v, long long n) {
for (long long i = 0; i < n; i++) a[i] = v;
}
void memset_s(char a[], char v, long long n) {
for (long long i = 0; i < n; i++) a[i] = v;
}
int compare(const void* a, const void* b) {
return (*(long long*)a - *(long long*)b);
}
void q_sort(long long a[], long long n) {
qsort(a, n, sizeof(long long), compare);
}
static int compare1(const void* a, const void* b) {
if (*(double*)a > *(double*)b)
return 1;
else if (*(double*)a < *(double*)b)
return -1;
else
return 0;
}
void q_sort_d(double a[], long long n) {
qsort(a, n, sizeof(double), compare1);
}
long long sum(long long n) {
long long i = 0, a[6], j, k = 0;
while (n > 0) {
a[i] = n % 10;
n /= 10;
i++;
}
for (j = 0; j < i; j++) k += a[j];
return k;
}
string trans_upper(string ss) {
transform(ss.begin(), ss.end(), ss.begin(), ::toupper);
return ss;
}
long long power(long long n, long long m) {
long long f = 1;
for (long long i = 0; i < m; i++) {
f = f * n;
}
return f;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long t, l, p, q, r, i, j, h, k, e = 0, f = 0, g = 0;
long long temp = 0, n, m, d = 0, nl, np;
cin >> n >> p >> q >> h >> l;
n = n - p;
d = 1;
while (n > 0) {
d++;
n = n + l;
p = p + h;
r = min(p, q);
n = n - r;
}
cout << d;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int ntrang, ngaydau, toida, heso, doclai, kq, tong;
while (scanf("%d %d %d %d %d", &ntrang, &ngaydau, &toida, &heso, &doclai) >
0) {
kq = 0;
tong = 0;
while (ntrang > tong) {
if (kq == 0) {
tong += (ngaydau);
} else {
tong += (min(toida, heso * kq + ngaydau) - doclai);
}
kq++;
}
printf("%d\n", kq);
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int ar[1000];
int main() {
int i, j, k, c, v1, v2, a, l, m, s, n, ans = 1, w = 0;
cin >> c >> v1 >> v2 >> a >> l;
m = v1;
while (v1 < c) {
v1 -= l;
if (v1 < 1) v1 = 1;
w++;
if (m + (a * w) <= v2) {
v1 += (a * w) + m;
} else
v1 += v2;
if (v1 >= c) {
ans++;
break;
}
ans++;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int d = 1;
int r = v0;
int tmp = v0;
while (1) {
if (r >= c) break;
tmp = tmp + a;
if (tmp > v1) tmp = v1;
r += (tmp - l);
d++;
}
cout << d << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int sum = 0;
int cur = v0;
int page_complete = 0;
for (int i = 1;; i++) {
page_complete = page_complete + cur;
if (page_complete >= c) {
cout << i;
return 0;
}
cur = cur + a;
if (cur >= v1) {
cur = v1;
}
page_complete -= l;
}
cout << sum;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int c, v0, v1, a, l, res, tam, j = 0;
int main() {
cin >> c >> v0 >> v1 >> a >> l;
tam = v0;
res = 1;
j = v0;
while (true) {
if (tam >= c) break;
tam -= l;
j += a;
if (j > v1) j = v1;
tam = tam + j;
res++;
}
cout << res;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = 2000000000;
const long long LINF = 9000000000000000000;
const long double EPS = 0.00001;
bool AinB(long long a, long long b, long long c, long long d) {
return c <= a && a <= d && c <= b && b <= d;
}
bool isller(long long a, long long b, long long c, long long d) {
return (a <= c && c <= b) || (a <= d && d <= b) || (c <= a && a <= d) ||
(c <= b && b <= d);
}
template <class T, class F, T fZero>
struct Node {
F f;
Node<T, F, fZero> *L, *R;
T t;
void recalc() {
t = f((L != nullptr ? L->t : fZero), (R != nullptr ? R->t : fZero));
}
Node(Node<T, F, fZero> *Left, Node<T, F, fZero> *Right) {
L = Left;
R = Right;
recalc();
}
};
template <class T, class F, T fZero>
T get(Node<T, F, fZero> *v, long long tl, long long tr, long long l,
long long r) {
if (AinB(tl, tr, l, r)) {
return v->t;
} else if (!isller(tl, tr, l, r)) {
return fZero;
} else {
long long tm = (tl + tr) / 2;
return v->f(get(v->L, tl, tm, l, r), get(v->R, tm + 1, tr, l, r));
}
}
template <class T, class F, T fZero>
void update(Node<T, F, fZero> *v, long long tl, long long tr, long long pos,
T val) {
if (tl == pos && tl == tr) {
v->t = val;
} else {
long long tm = (tl + tr) / 2;
if (pos <= tm) {
update(v->L, tl, tm, pos, val);
} else {
update(v->R, tm + 1, tr, pos, val);
}
v->recalc();
}
}
template <class T, class F, T fZero>
void build(Node<T, F, fZero> *&v, long long tl, long long tr, vector<T> &a) {
if (tl == tr) {
v->t = a[tl];
} else {
long long tm = (tl + tr) / 2;
Node<T, F, fZero> *Left = new Node<T, F, fZero>(nullptr, nullptr);
Node<T, F, fZero> *Right = new Node<T, F, fZero>(nullptr, nullptr);
build(Left, tl, tm, a);
build(Right, tm + 1, tr, a);
v->L = Left;
v->R = Right;
v->recalc();
}
}
struct Min {
long long operator()(long long a, long long b) { return (a < b ? a : b); }
};
struct Sum {
long long operator()(long long a, long long b) { return a + b; }
};
void solve() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int pos = 0;
int v = v0;
int day = 0;
while (pos < c) {
if (day != 0) v += a;
if (v > v1) v = v1;
pos += v - min(l, pos);
++day;
}
cout << day;
return;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cout.precision(20);
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int v0, v1, c, l, a, i, p = 0, n = 1;
cin >> c >> v0 >> v1 >> a >> l;
i = v0;
p = v0;
while (p < c && c > v0) {
n++;
if (i <= v1 - a)
i = i + a;
else
i = v1;
p = p + i - l;
}
cout << n;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
long long count = v0;
long long d = 1;
while (count < c) {
d++;
v0 += a;
v0 = min(v0, v1);
count += v0 - l;
}
cout << d << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
static int rowNbr[] = {-1, -1, -1, 0, 0, 1, 1, 1};
static int colNbr[] = {-1, 0, 1, -1, 1, -1, 0, 1};
long long int power(long long int base, long long int p) {
long long int ans = 1;
while (p) {
if (p & 1) ans = (ans * base);
base = (base * base);
p /= 2;
}
return ans;
}
long long int modPower(long long int base, long long int p,
long long int mod = (1000000007LL)) {
long long int ans = 1;
while (p) {
if (p & 1) ans = (ans * base) % mod;
base = (base * base) % mod;
p /= 2;
}
return ans;
}
long long int gcd(long long int a, long long int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int day = 1;
int read = v0;
if (v0 < c) {
while (1) {
++day;
if (read >= c) break;
read += min(v1, v0 + (day - 1) * a) - l;
}
cout << day - 1;
} else
cout << "1";
}
|
#include <bits/stdc++.h>
int c, v0, v1, a, l;
int main() {
scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &l);
int i, t = 0;
for (i = 1;; i++) {
t += v0;
if (t >= c) break;
v0 += a;
if (v0 > v1) v0 = v1;
t -= l;
}
printf("%d", i);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
int c, v1, v2, a, l;
cin >> c >> v1 >> v2 >> a >> l;
int wynik = 0;
int ile = 0;
wynik += v1;
ile++;
while (wynik < c) {
v1 += a;
wynik += min(v1, v2);
wynik -= l;
ile++;
}
cout << ile;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
long long c, vo, v1, a, l;
cin >> c >> vo >> v1 >> a >> l;
long long p = 0;
long long count = 0;
while (p < c) {
if (count == 0)
p += min(vo + count * a, v1);
else
p += min(vo + count * a, v1) - l;
count++;
}
cout << count;
}
|
#include <bits/stdc++.h>
using namespace std;
int c, v0, v1, a, l;
int main() {
scanf("%d %d %d %d %d", &c, &v0, &v1, &a, &l);
int atual = v0;
if (v0 >= c) return printf("1\n"), 0;
int inc = v0;
int day = 1;
while (1) {
inc += a;
inc = min(inc, v1);
atual += inc - l;
day++;
if (atual >= c) break;
}
printf("%d\n", day);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
for (int day = 0; true; day++) {
int read = min(v1, v0 + day * a);
if (day > 0) c += l;
c -= read;
if (c <= 0) {
cout << day + 1 << endl;
break;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
while (scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &l) != EOF) {
int sum = v0;
int i = 1;
int count = 1;
while (sum < c) {
int series = v0 + (a * i);
if (series > v1) series = v1;
sum += series - l;
count++;
i++;
}
printf("%d\n", count);
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int c, l, v0, v1, a;
inline bool read() {
if (!(cin >> c >> v0 >> v1 >> a >> l)) return false;
return true;
}
inline void solve() {
int pos = v0;
int t = 1;
int add = v0;
while (pos < c) {
add = min(v1, add + a);
pos += add - l;
t++;
}
cout << t << endl;
}
int main() {
read();
solve();
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, s = 0, l, x = 0, y = 0, z = 0;
cin >> c >> v0 >> v1 >> a >> l;
int m = v0;
for (int i = 0; z < c; i++) {
x = i * a;
s = m + x;
if (s <= v1) {
z = z + s;
} else {
z = z + v1;
}
if (i != 0) z = z - l;
y++;
}
cout << y;
}
|
#include <bits/stdc++.h>
int c, v0, v1, a, l;
int main() {
scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &l);
int ct = v0, days = 1;
while (ct < c) {
++days;
ct += std::min(v1, v0 + a * (days - 1)) - l;
}
printf("%d\n", days);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
while (scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &l) != EOF) {
int sum = 0;
if (v0 > v1) v0 = v1;
for (int i = 1;; i++) {
if (v0 > v1) v0 = v1;
sum += v0;
v0 += a;
if (sum >= c) {
printf("%d\n", i);
return 0;
}
sum -= l;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int c, v0, v1, l, a;
cin >> c >> v0 >> v1 >> a >> l;
int i;
int sum = v0;
for (i = 1;; ++i) {
if (sum >= c) break;
sum += min(v1 - l, v0 + i * a - l);
}
cout << i;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v, v1, a, l;
cin >> c >> v >> v1 >> a >> l;
int pages_read = 0;
int days = 0;
while (1) {
pages_read += (min(v + (days * a), v1));
days++;
if (pages_read >= c) break;
pages_read -= l;
}
cout << days << endl;
}
|
#include <bits/stdc++.h>
bool isPrime(int n) {
if (n <= 1)
return false;
else if (n <= 3)
return true;
else if ((n % 2 == 0) || (n % 3 == 0))
return false;
int i = 5;
while (i * i <= n) {
if ((n % i == 0) || (n % (i + 2) == 0)) return false;
i += 6;
}
return true;
}
int gcd(int a, int b) {
if (a == b) return a;
if (a > b) return gcd(a - b, b);
return gcd(a, b - a);
}
int lcm(int a, int b) { return (a * b) / gcd(a, b); }
using namespace std;
int lis(vector<int> arr, int n) {
int *lis, i, j, max = 0;
lis = (int *)malloc(sizeof(int) * n);
for (i = 0; i < n; i++) lis[i] = 1;
for (i = 1; i < n; i++)
for (j = 0; j < i; j++)
if (arr[i] > arr[j] && lis[i] < lis[j] + 1) lis[i] = lis[j] + 1;
for (i = 0; i < n; i++) {
if (max < lis[i]) max = lis[i];
}
return max;
}
int c, v0, v1, a, l;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
cin >> c >> v0 >> v1;
cin >> a >> l;
c -= v0;
int x = 1;
while (c > 0) {
c = c + l - min(v1, v0 + a * x);
x++;
}
cout << x;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int mx = 3e5 + 100;
int main() {
long long c, d, e, a, l, temp = 0, p = 0, i = 1, ans;
cin >> c >> d >> e >> a >> l;
while (true) {
if (d + a * p >= e)
ans = e;
else
ans = d + a * p;
temp += ans;
if (temp >= c) {
cout << i << endl;
return 0;
}
temp -= l;
temp = max(temp, 0 * 1ll);
p++;
i++;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, L;
int i = 0;
cin >> c >> v0 >> v1 >> a >> L;
while (c > 0) {
c -= v1 < v0 + i * a ? v1 : v0 + i * a;
i++;
if (c > 0) c += L;
}
cout << i << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int d = 1, red = v0;
while (red < c) {
int tr = min(v1, v0 + d * a);
red += tr - l;
d++;
}
cout << d << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int f = 1;
for (;; f++) {
c -= v0;
v0 += a;
if (v0 > v1) v0 = v1;
if (c <= 0) return 0 * printf("%d", f);
c += l;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int isprime(int n) {
int i;
for (i = 2; i * i <= n; i++) {
if (n % i == 0) return 0;
}
return 1;
}
int main() {
long long int n, k = 0, i = 0, m, x = 0, y, q, r, s, l, t, a, v0, v1, c, b,
j = 0, d = 0, ct = 0, sum = 0, h[1000009] = {0},
temp = 10000, fl = 0;
cin >> c >> v0 >> v1 >> a >> l;
for (i = 0;; i++) {
if ((v0 + a * i) <= v1)
c = c - (v0 + a * i);
else
c -= v1;
if (c <= 0) break;
c += l;
}
cout << i + 1;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int s = v0;
int rem = c;
int reread = 0;
int days = 0;
while (1) {
days++;
if (c + reread <= s) {
break;
}
c = c - s + reread;
s = s + a;
reread = l;
s = min(s, v1);
}
cout << days;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, vi, a, l;
scanf("%d %d %d %d %d", &c, &v0, &vi, &a, &l);
int atual = v0;
int cont = 0;
int page = 0;
while (page < c) {
cont++;
page += atual;
if (page >= c) {
break;
}
page -= l;
atual = min(vi, atual + a);
}
printf("%d\n", cont);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int c, v0, v1, a, l;
int main() {
scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &l);
int ans = 1;
int now = v0;
int x = v0;
while (now < c) {
x += a;
if (x > v1) x = v1;
now += x - l;
++ans;
}
printf("%d\n", ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 7;
const long double pi = acos(-1);
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
if (c <= v0) {
cout << 1 << '\n';
return 0;
}
int tot = v0, days = 1;
while (tot < c) {
tot += min(v0 + a * days, v1) - l;
++days;
}
cout << days << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
while (cin >> c >> v0 >> v1 >> a >> l) {
int ans = 0;
int p;
p = v0;
ans++;
int i = 1;
int s = v0;
while (s < c) {
int k = v0 + (i * a);
if (k > v1) k = v1;
k -= l;
s += k;
ans++;
i++;
}
cout << ans << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int c, vo, term, v1, a, l, ans = 1, sum;
scanf("%d%d%d%d%d", &c, &vo, &v1, &a, &l);
sum = vo;
term = vo + a;
while (sum < c) {
if (term < v1) {
sum = term + sum - l;
term = term + a;
} else
sum = sum + v1 - l;
ans++;
}
printf("%d\n", ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int b, n, p, q, i, j, r, s, y;
cin >> n >> p >> q >> r >> s;
b = p;
y = p;
for (i = 1;; i++) {
if (p >= n) {
break;
}
b = (y + (i * r));
if (b > q) {
b = q;
}
p += b;
p -= s;
}
cout << i << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const int mod = inf + 7;
int c, v0, v1, a, l, cnt;
int main() {
cin >> c >> v0 >> v1 >> a >> l;
int ind = 0;
while (true) {
if (cnt >= c) {
break;
}
if (ind == 0) {
if (v0 <= v1) {
cnt += v0;
} else {
cnt += v1;
}
} else {
int t = v0 + ind * a;
cnt -= l;
if (t <= v1) {
cnt += t;
} else {
cnt += v1;
}
}
ind++;
}
cout << ind;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long c, w, v, a, l, pages, days = 1;
cin >> c >> v >> w >> a >> l;
pages = v;
while (pages < c) {
v += a;
if (v > w) v = w;
pages = pages - l + v;
days++;
}
cout << days;
}
|
#include <bits/stdc++.h>
struct mStruct {
long long int a, b;
};
bool comp(mStruct a, mStruct b) { return a.a + a.b > b.a + b.b; }
using namespace std;
void checkDefine();
long long int c, v0, v1, a, l;
int main() {
cin >> c >> v0 >> v1 >> a >> l;
long long int mn = min(v0, v1);
long long int res = mn;
long long int i = 1;
do {
if (res >= c) {
cout << i;
return 0;
}
res += min(v1, v0 + i * a);
if (i >= 1) res -= l;
i++;
} while (true);
return 0;
}
void checkDefine() {
long long int n, a[200005];
map<long long int, long long int> m;
cin >> n;
for (int i = (0), _b = (n - 1); i <= _b; i++) {
cin >> a[i];
m[a[i]]++;
}
string s;
cin >> s;
{
cout << "s"
<< " = ";
cout << (s) << endl;
};
{
cout << "a"
<< " = ";
for (int _ = 0, _a = (n); _ < _a; _++) cout << a[_] << ' ';
cout << endl;
};
{
cout << "\"------------\""
<< " = ";
cout << ("------------") << endl;
};
for (__typeof(m.begin()) it = m.begin(); it != m.end(); ++it) {
cout << it->first << " " << it->second << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int ans = 1;
int val = v0;
if (val != c) {
while (c > val) {
val -= l;
int sub = min(v0 + ans * a, v1);
val += sub;
ans++;
}
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int c, v0, v1, a, l;
scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &l);
int now = 0;
int day = 0;
while (1) {
now += v0;
v0 += a;
if (v0 > v1) {
v0 = v1;
}
day++;
if (now >= c) {
printf("%d", day);
break;
}
now -= l;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l, d = 1, t;
cin >> c >> v0 >> v1 >> a >> l;
while (d) {
if (d == 1) {
t = v0;
} else if (d > 1) {
t = (v0 + (d - 1) * a);
}
if (d == 1) {
c = c - t;
} else if (t <= v1 && d > 1) {
c = c - (t - l);
} else if (t > v1) {
c = c - (v1 - l);
}
if (c <= 0) {
cout << d;
break;
}
d++;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int c, v0, v1, a, l;
int main() {
scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &l);
int ans = 0, page = 0;
while (++ans) {
page = max(0, page - l);
page += v0;
v0 = v0 + a;
v0 = min(v0, v1);
if (page >= c) break;
}
printf("%d\n", ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int days = 1, prev = v0;
while (prev < c) {
prev = prev - l + min(v0 + days * a, v1);
days++;
}
cout << days;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
while (t--) {
solve();
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l, ans = 0;
scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &l);
for (int i = 0; i != -1; i++) {
ans++;
int cur = min(v1, v0 + i * a);
c -= cur;
if (c <= 0) break;
c += l;
}
printf("%d\n", ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v, v1, a, l;
cin >> c >> v >> v1 >> a >> l;
int s = v;
int ct = 1;
while (s < c) {
if (v + (ct * a) > v1)
s += v1 - l;
else {
s += v + (ct * a) - l;
}
ct++;
}
cout << ct;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
const long long mod = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long c, v0, v1, a, l, ans = 0;
cin >> c >> v0 >> v1 >> a >> l;
long long tot = 0;
while (tot < c) {
long long add = v0 - l * (ans > 0);
tot = tot + add;
v0 = min(v0 + a, v1);
ans++;
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int v0, v1, c, a, l, days, read, prev;
cin >> c >> v0 >> v1 >> a >> l;
read = v0;
prev = read;
days = 1;
while (read < c) {
if (prev + a < v1) {
read += prev + a - l;
prev += a;
} else {
read += v1 - l;
prev = v1;
}
days++;
}
cout << days;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int c, v0, v1, a, l, v;
cin >> c >> v0 >> v1 >> a >> l;
int i = 0, r = 0, count = 0;
while (c > 0) {
if (v0 + i * a <= v1) {
v = v0 + i * a;
} else {
v = v1;
}
count++;
i++;
if (count > 1) {
r = v - l;
} else {
r = v;
}
c = c - r;
v = v0;
}
cout << count << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int ans = 1;
int now = v0;
while (now < c) {
v0 += a;
if (v0 > v1) v0 = v1;
now += v0 - l;
ans++;
}
printf("%d\n", ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int binsearch(int arr[], int n, int element) {
int low = 0, high = n - 1;
while (low <= high) {
int mid = low + (high - low) / 2;
if (arr[mid] == element)
return mid;
else if (arr[mid] < element)
low = mid + 1;
else
high = mid - 1;
}
return -1;
}
void printArr(int arr[], int n) {
for (int i = 0; i < n; i++) {
cout << arr[i] << " ";
}
cout << "\n";
return;
}
int modexp(int x, unsigned int y, int p) {
int res = 1;
x = x % p;
while (y > 0) {
if (y & 1) res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
void solve() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int pages_read = 0, days = 0;
while (pages_read < c) {
days++;
if (days == 1)
pages_read += min(v0, v1);
else
pages_read += min((v0 + a * (days - 1) - l), v1 - l);
}
cout << days << endl;
return;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t = 1;
while (t) {
solve();
t--;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
scanf("%d %d %d %d %d", &c, &v0, &v1, &a, &l);
int cur = v0;
int ans = 1;
for (int i = 1; cur < c; ++i) {
int t = min(v1, v0 + i * a) - l;
cur += t;
ans++;
}
printf("%d\n", ans);
}
|
#include <bits/stdc++.h>
using namespace std;
int c, v_0, v_1, a, l, cnt, lp;
int main() {
cin >> c >> v_0 >> v_1 >> a >> l;
cnt = v_0;
lp = cnt;
if (lp >= c) return cout << 1 << '\n', false;
for (int i = (2); i < (c + 10); i++) {
if (cnt + a >= v_1) {
cnt = v_1;
lp += cnt - l;
} else {
cnt += a;
lp += cnt - l;
}
if (lp >= c) {
return cout << i << '\n', false;
}
}
return false;
}
|
#include <bits/stdc++.h>
using namespace std;
int c, v0, v1, a, l;
int main() {
while (~scanf("%d %d %d %d %d", &c, &v0, &v1, &a, &l)) {
int ans = 0;
while (c > 0) {
c -= v0;
if (ans) c += l;
ans++;
v0 = v0 + a;
v0 = min(v0, v1);
}
printf("%d\n", ans);
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int v = v0, ans = 0;
while (c > 0) {
ans++;
c -= v;
if (c <= 0) break;
c += l;
v = min(v + a, v1);
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int n = 1;
int x = 0;
int t = 0;
for (;;) {
if (n == 1) {
x = v0;
t = v0;
if (x >= c) {
cout << 1 << endl;
return 0;
}
n = 2;
} else {
x -= l;
t += a;
t = min(v1, t);
x += t;
if (x >= c) {
cout << n << endl;
return 0;
}
n++;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long x, y, z, ans, cnt;
bool b;
string num_to_string(int num) {
stringstream ss;
ss << num;
return ss.str();
}
void O_o() {
ios::sync_with_stdio(0);
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
}
int main() {
O_o();
long long c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
cnt += v0;
ans++;
y++;
while (cnt < c) {
if (v0 + y * a <= v1)
cnt += (v0 + y * a) - l;
else
cnt += v1 - l;
y++;
ans++;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int c, a, m, d, l;
cin >> c >> a >> m >> d >> l;
int ans = 0;
int read = a;
while (c > 0) {
ans++;
c -= read;
read += d;
if (read > m) {
read = m;
}
if (c <= 0) {
break;
}
c += l;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int p = 0, days = 0;
while (true) {
days++;
p += v0;
if (p >= c) {
break;
}
v0 += a;
if (v0 > v1) {
v0 = v1;
}
p -= l;
}
cout << days << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void fun() {}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
;
fun();
long long int c, v, u, a, l, p = 0, ans = 1;
cin >> c >> v >> u >> a >> l;
p += v;
while (p < c) {
v += a;
p += min(v, u) - l;
ans++;
}
cout << ans;
cerr << "time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
const int inf = 1e9;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long int c, v, v1, l, a, i, j;
cin >> c >> v >> v1 >> a >> l;
long long int cnt = 0, curr = 0, prev = 0;
cnt++;
c -= v;
curr = v;
while (c > 0) {
cnt++;
curr += a;
curr = min(curr, v1);
c -= (curr - l);
}
cout << cnt, cout << "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int min(int a, int b);
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int pages = c, i = 0;
while (pages > 0) {
pages = pages - min(v0 + i * a, v1);
if (pages == 0) {
i++;
break;
}
i++;
if (pages < 0) break;
pages += l;
}
cout << i << '\n';
return 0;
}
int min(int a, int b) { return (a < b) ? a : b; }
|
#include <bits/stdc++.h>
int main() {
int c, v0, v1, a, l, i;
scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &l);
for (i = 1;; i++) {
int v;
v = v0 + (i - 1) * a;
if (v > v1) v = v1;
c = c - v;
if (c <= 0)
break;
else
c += l;
}
printf("%d", i);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int pages = 0;
int days = 0;
while (true) {
++days;
pages += v0;
if (pages >= c) break;
v0 = min(v0 + a, v1);
pages -= l;
}
cout << days << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7FFFFFFF;
void Filework(void) {
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
}
int c, v0, v1, l, a;
int d;
int total;
int main() {
int i;
scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &l);
total = 1;
while (true) {
d++;
if (d != 1) {
total -= l;
}
total += (v0 - 1);
v0 += (a);
if (v0 >= v1) v0 = v1;
if (total >= c) break;
total++;
}
printf("%d\n", d);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
scanf("%d%d%d%d", &c, &v0, &v1, &a);
scanf("%d", &l);
int pcnt = 0;
int dcnt = 0;
while (true) {
if (pcnt >= c) break;
if (dcnt == 0) {
if (pcnt + v0 <= v1)
pcnt = pcnt + v0;
else
pcnt = pcnt + v1;
dcnt++;
continue;
} else {
pcnt = pcnt - l;
if (v0 + dcnt * a <= v1)
pcnt = pcnt + (v0 + dcnt * a);
else
pcnt = pcnt + v1;
dcnt++;
}
}
cout << dcnt;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v, vv, a, l;
cin >> c >> v >> vv >> a >> l;
int cnt = 0;
int s = 0;
while (true) {
cnt += 1;
s = s + v;
v += a;
if (v > vv) {
v = vv;
}
if (s >= c) {
cout << cnt << endl;
break;
}
s -= l;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int c, v0, v1, a, l;
void solve() {
cin >> c >> v0 >> v1 >> a >> l;
int left = c - v0;
int ans = 1;
if (left <= 0) {
cout << 1 << "\n";
} else {
for (int i = 1; left > 0; i++) {
int x = v0 + i * a;
x = min(x, v1);
x -= l;
left -= x;
ans++;
}
cout << ans << "\n";
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t = 1, i = 1;
while (t--) {
solve();
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l, i, j, count = 1, h;
cin >> c >> v0 >> v1 >> a >> l;
c = c - v0;
j = v0;
while (c > 0) {
i = j + a - l;
if (j + a > v1) i = v1 - l;
j = i + l;
c = c - i;
count++;
}
cout << count;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l, sum = 0;
cin >> c >> v0 >> v1 >> a >> l;
int i = 0, b;
while (1) {
b = v0 + i * a;
if (b >= v1) b = v1;
sum = sum + b;
i++;
if (sum >= c)
break;
else
c += l;
}
cout << i << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int v0, v1, a, c, l;
int main() {
scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &l);
int crtPage = v0, day = 1, nrp = v0;
while (crtPage < c) {
nrp = min(v1, nrp + a);
crtPage += nrp - l;
++day;
}
printf("%d\n", day);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int t = v0;
int d = 1;
while (t < c) {
t -= l;
v0 = min(v0 + a, v1);
t += v0;
d++;
}
cout << d;
}
|
#include <bits/stdc++.h>
using namespace std;
int c, v0, v1, a, l;
int main() {
cin >> c >> v0 >> v1 >> a >> l;
int tx = l;
int i = -1;
while (1) {
tx -= l;
tx += min(v1, v0 + (++i) * a);
if (tx >= c) {
cout << i + 1;
exit(0);
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, c, i, a, m, l, r;
cin >> t >> i >> m >> a >> l;
r = i;
c = 1;
t = t - r;
while (t > 0) {
c++;
r = r + a;
if (r > m) r = m;
t = t + l - r;
if (t < 0) t = 0;
}
cout << c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v, m, l, a, i = 1, x;
cin >> c >> v >> m >> a >> l;
x = v;
while (x < c) x += min(v + i * a - l, m - l), i++;
cout << i << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int ans, c, v0, v1, a, l;
int main() {
scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &l);
while (c > 0) {
ans++;
if (ans > 1)
c = c + l - v0;
else
c -= v0;
v0 = min(v0 + a, v1);
}
printf("%d\n", ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(NULL);
ios::sync_with_stdio(0);
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int i = v0;
int ans = 1;
for (; i < c;) {
i -= l;
i += min(v1, v0 + ans * a);
ans++;
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
int c, v0, v1, a, l;
int ans, speed;
while (~scanf("%d %d %d %d %d", &c, &v0, &v1, &a, &l)) {
ans = 1;
c -= v0;
speed = v0;
while (c > 0) {
speed += a;
speed = min(speed, v1);
c -= speed;
c += l;
++ans;
}
printf("%d\n", ans);
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 1e5 + 5;
int main() {
long long int c, v, v1, a, l, ans = 0, op = 0;
cin >> c >> v >> v1 >> a >> l;
for (int i = 0; op < c; i++) {
if (i) c += l;
ans++;
c -= min((v + a * i), v1);
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int r = v0, ans = 1;
while (r < c) {
v0 += a;
v0 = min(v0, v1);
r -= l;
r = max(0, r);
r += v0;
ans++;
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int ans = 0;
while (c > 0) {
int to_subtract = min(v1, v0 + a * ans);
c -= to_subtract;
if (c > 0) c += l;
++ans;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int pw(int k) {
int g = 1;
for (int f = 0; f < k; f++) g *= 10;
return g;
}
struct vecteur {
long X;
long Y;
long Z;
double n;
};
long long produit(long A, long B, long C, long D) { return (A * B - C * D); }
double norme(long E, long F, long G) {
return (sqrt((E * E) + (F * F) + (G * G)));
}
unsigned long long fact(int y) {
unsigned long long h = 1;
if (y == 0 || y == 1)
return 1;
else {
for (unsigned long long j = 1; j < y; j++) {
h *= (j + 1);
}
return h;
}
}
long long counter(long long a) {
long long c = 0;
for (long long i = 1; i <= a; i++) {
if (a % i == 0) c++;
}
return c;
}
bool isprime(unsigned long long a) {
for (unsigned long long i = 2; i < a; i++) {
if (a % i == 0) return 0;
}
return 1;
}
unsigned long long t[60][60];
int main() {
int c, v0, v1, a, l, f = 0, h = 0;
cin >> c >> v0 >> v1 >> a >> l;
c -= v0;
f++;
h = v0 + a;
while (c > 0) {
int g = min(v1, h);
c -= g;
c += l;
f++;
h += a;
}
cout << f;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int sum = 0, ans = 0;
while (sum < c) {
ans++;
sum += v0;
if (sum >= c) break;
if (v0 + a <= v1) {
v0 += a;
} else {
v0 = v1;
}
sum -= l;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int c, v0, v1, a, l, i = 1;
cin >> c >> v0 >> v1 >> a >> l;
c -= v0;
if (v0 < v1) {
v0 += a;
if (v0 > v1) v0 = v1;
}
while (c > 0) {
c = c - v0 + l;
if (v0 < v1) {
v0 += a;
if (v0 > v1) v0 = v1;
}
i++;
}
cout << i;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
double sqr(double a) { return a * a; }
struct point {
int x, y;
};
int dll(int a) {
for (int i = sqrt(a) + 1; i > 1; i--) {
if (a % i == 0) {
return i;
}
}
return 1;
}
void prov(string s) {
int k = 0, ot = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] == 'X') k++;
if (s[i] == 'O') ot++;
}
if (k == 4 && !ot) {
cout << "YES" << endl;
exit(0);
}
}
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int ans = 1, now = v0;
v0 = min(v0 + a, v1);
while (now < c) {
now += v0;
now -= l;
ans++;
v0 = min(v0 + a, v1);
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int v0, v1, c, l, a, day = 0;
cin >> c >> v0 >> v1 >> a >> l;
while (c > 0) {
c -= v0;
v0 += a;
if (v0 > v1) v0 = v1;
if (c > 0) c += l;
day++;
}
cout << day << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int speed = v0, day = 0, page = 0;
while (page < c) {
++day;
page += speed;
if (day > 1) page -= l;
speed += a;
if (speed > v1) speed = v1;
}
cout << day << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
long long ans = 1, c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
long long i = 1, cur = v0;
while (cur < c) {
cur += min(v0 + a * i, v1) - l;
i++;
ans++;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int c, v0, v1, a, w;
while (~scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &w)) {
int i = v0, t = 1;
while (i < c) {
i -= w;
if (i < 0) i = 0;
if ((v0 + a) > v1) {
v0 = v1;
} else
v0 += a;
i += v0;
t++;
}
printf("%d\n", t);
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int c, v0, v1, a, l;
cin >> c >> v0 >> v1 >> a >> l;
int p = v0, d = 1;
while (p < c) {
int pages = min(d * a + v0, v1) - l;
p += pages;
d++;
}
cout << d << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6;
int c, v0, v1, a, l;
int main() {
while (cin >> c >> v0 >> v1 >> a >> l) {
if (v0 >= c)
cout << "1\n";
else {
int s = v0;
for (int i = 2;; i++) {
int d = v0 + a * (i - 1);
d = min(d, v1);
d -= l;
s += d;
if (s >= c) {
cout << i << endl;
break;
}
}
}
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int pages, start, max, increase, reread;
std::cin >> pages;
std::cin >> start;
std::cin >> max;
std::cin >> increase;
std::cin >> reread;
int days = 0;
int currentPage = reread;
int currentSpeed = start - reread;
do {
currentPage += currentSpeed;
currentSpeed += increase;
if (currentSpeed > max - reread) currentSpeed = max - reread;
days++;
} while (currentPage < pages);
std::cout << days;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.