Pagini recente »
2021_10_20_lab_div
|
Cod sursă (job #811987)
|
Istoria paginii runda/cvv6_4/clasament
|
cerc-678-20130219
|
Cod sursă (job #464382)
Cod sursă (job
#464382)
#include <bits/stdc++.h>
using namespace std;
int main()
{
ifstream cin("scv.in");
ofstream cout("scv.out");
int n, m, k, l, cs = 1, time = 0, current = 0;
cin >> n >> m >> k >> l;
while (current < l)
{
while (current < l && current < n)
time ++, current += cs * k;
if (current + m * cs * k + cs * k * (n / k) < l)
current += cs * k * m - n, time += m, cs++;
else while (current < l)
time ++, current += cs * k;
}
cout << time;
return 0;
}