Pagini recente »
Istoria paginii utilizator/cristinacr
|
Istoria paginii runda/s3_lab_10/clasament
|
Clasament probleme_multe
|
noua_pregatire_olimpiada_clasa_a_7-a
|
Cod sursă (job #416201)
Cod sursă (job
#416201)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("scv.in");
ofstream g("scv.out");
int cost,timp,cantit,S,s,K,T;
int main ()
{
f>>cost>>timp>>cantit>>S;
s=0;
K=1;
while(s<S){
while(s<S && s<cost){
s=s+K*cantit;
T++;
}
if(s+K*cantit*timp+cantit*K*(cost/cantit)<S){
T=T+timp;
s=s-cost;
s=s+timp*K*cantit;
K++;
}
else{
while(s<S){
s=s+K*cantit;
T++;
}
}
}
g<<T;
return 0;
}