Pagini recente »
Diferențe pentru runda/zeul_nostru.1 între reviziile 14 și 8
|
Monitorul de evaluare
|
Cod sursă (job #561674)
Cod sursă (job
#561674)
#include <fstream>
using namespace std;
ifstream fin ("scv.in");
ofstream fout("scv.out");
int c,t,m,x,productie;
int mats,zile,f,g,h;
int ceiling(int p,int q)
{
return p/q+bool(p%q);
}
int main()
{
fin>>c>>t>>m>>x;
fin.close();
f=min(c,x);
productie=m;
h=c/m;
while(mats<x)
{
g=ceiling(f-mats,productie);
zile+=g;
mats+=productie*g;
if(productie*(t+h)<x-mats)
{
zile+=t;
mats+=(productie*t-c);
productie+=m;
}
else
{
zile+=ceiling(x-mats,productie);
mats=x;
}
}
fout<<zile;
}