Cod sursă (job #465401)

Utilizator avatar nicutkacenko Nicu Tkacenko nicutkacenko IP ascuns
Problemă SCV (clasele 9-10) Compilator cpp | 0,43 kb
Rundă lasm_31_03_2019_10_12 Status evaluat
Dată 2 apr. 2019 18:57:08 Scor 100
#include <bits/stdc++.h>
using namespace std;

long long c ,t ,m ,x,total,zile,cm;

int main(){
	ifstream cin("scv.in");
	ofstream cout("scv.out");
	cin>>c>>t>>m >>x;
	
	cm=m;
	while(total<x){
		while(total<c && total<x){
		zile++;
		total+=m;
	}
	if(total+m*t+m*(c/cm)<x ){
	zile+=t;
	total-=c;
	total+=m*t;
	m+=cm;
	}
	else{
			while(total < x){
			zile++;
			total+=m;
			}
		}
	}
	cout<<zile;
return 0;
}