Cod sursă (job #469778)

Utilizator avatar gabrielatulbu Tulbu Gabriela gabrielatulbu IP ascuns
Problemă SCV (clasele 9-10) Compilator cpp | 0,61 kb
Rundă Arhiva de probleme Status evaluat
Dată 13 apr. 2019 14:48:06 Scor 100
#include <bits/stdc++.h>
using namespace std;
int main(){
    ifstream fin("scv.in");
    ofstream fout("scv.out");
    int c ,t ,m ,x;
    fin>>c>>t>>m>>x;
    int total=0;
    int zile=0 ,cm;
    cm=m;
    while(total<x) {
        while(total<c && total<x) { zile++; total+=m;}
        if(total+m*t+m*(c/cm)<x ) { zile+=t; total-=c; total+=m*t; m+=cm; } else {
                                                                                while(total < x){ zile++; total+=m;}
                                                                                        }
        }
    fout<<zile;
return 0;
}