Pentru această operație este nevoie să te autentifici.
Cod sursă (job #466135)
Utilizator |
|
IP | ascuns |
---|---|---|---|
Problemă | SCV (clasele 9-10) | Compilator | cpp | 0,56 kb |
Rundă | lasm_03_04_2019_10_12 | Status | evaluat |
Dată | 4 apr. 2019 13:30:05 | Scor | 100 |
#include<bits/stdc++.h>
using namespace std;
int c,t,m,x,k,nr,n,rs;
int main() {
ifstream cin("scv.in");
ofstream cout("scv.out");
cin>>c>>t>>m>>x; k=1;
while (nr<x) {
while (nr<c && nr<x) {
++rs; nr+=m*k;
}
if (nr>=x) break;
int tmp=nr+m*k*t+m*k*(c/m);
if (tmp<x) {
rs+=t;
nr=nr-c+m*t*k;
++k;
} else {
while (nr<x) {
++rs; nr+=m*k;
}
}
}
cout<<rs;
return 0;
}