Cod sursă (job #158141)
Utilizator |
|
IP | ascuns |
---|---|---|---|
Problemă | SCV (clasele 9-10) | Compilator | cpp | 0,53 kb |
Rundă | Arhiva de probleme | Status | evaluat |
Dată | 6 oct. 2015 10:45:56 | Scor | 100 |
#include <fstream>
using namespace std;
ifstream fin("scv.in");
ofstream fout("scv.out");
int i,j,c,m,x,t,mi,tm,tt;
int main(){
fin>>c>>t>>m>>x;
fin.close();
mi=m;
while(tm<x){
while(tm<min(x,c))
tt++,tm+=m;
if(tm+m*t+m*(c/mi)<x){
tm=tm+(m*t-c);
tt=t+tt;
m=m+mi;
}
else{
if ((x-tm)%m!=0)
tt++;
tt=tt+(x-tm)/m; tm=x;
}
}
fout<<tt;
fout.close();
return 0;
}