Cod sursă (job #465814)

Utilizator avatar Artanis Petrea Calin Artanis IP ascuns
Problemă SCV (clasele 9-10) Compilator cpp | 0,47 kb
Rundă lasm_03_04_2019_10_12 Status evaluat
Dată 3 apr. 2019 16:18:36 Scor 100
#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;
}