Cod sursă (job #819696)

Utilizator avatar ioanxh Budeanu Ioan ioanxh IP ascuns
Problemă SCV (clasele 9-10) Compilator cpp-32 | 0,68 kb
Rundă antrenament1 Status evaluat
Dată 9 apr. 2025 11:53:43 Scor 20
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops,inline")
#define fast ios_base::sync_with_stdio(0);f.tie(0);g.tie(0);
using namespace std;
const string file="scv";
ifstream f(file+".in");
ofstream g(file+".out");
//#define f cin
//#define g cout
int c,t,m,x,stoc,zile,scv=1;
bool ok;
int main(){
    f>>c>>t>>m>>x;
    while(stoc<x){
        if(stoc>=c){
            stoc-=c;
            int z=t;
            while(z>0){
                stoc+=scv*m;
                --z;
                ++zile;
                if(stoc>=x) break;
            }
            ++scv;
        }
        else stoc+=scv*m,zile++;


    }
    g<<zile;
    return 0;
}