Cod sursă (job #819767)
Utilizator |
|
IP | ascuns |
---|---|---|---|
Problemă | SCV (clasele 9-10) | Compilator | cpp-32 | 0,42 kb |
Rundă | antrenament1 | Status | evaluat |
Dată | 9 apr. 2025 13:54:54 | Scor | 20 |
#include<fstream>
using namespace std;
ifstream cin("scv.in");
ofstream cout("scv.out");
long long c,t,m,x,z,s,n=1,w;
int main()
{
cin>>c>>t>>m>>x;
while(s<x)
{
if(w==0 and s>=c)
{
s-=c;
w=t;
}
s+=n*m;
z++;
if(w>0)
{
w--;
if(w==0)
n++;
}
}
cout<<z;
}