Pagini recente »
Cod sursă (job #686012)
|
Monitorul de evaluare
|
lmk_11_vs
|
Istoria paginii utilizator/maria_diaconescu
|
Cod sursă (job #105146)
Cod sursă (job
#105146)
#include <stdio.h>
FILE *fin ,*fout;
int main()
{
fin = fopen ("scv.in" ,"r");
fout = fopen ("scv.out" , "w");
long long c ,t ,m ,x;
fscanf(fin , "%lld%lld%lld%lld" , &c , &t , &m , &x);
long long total=0;
long long zile=0 ,cm;
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;
}
}
}
fprintf(fout ,"%lld" ,zile);
return 0;
}