Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int c = 0; // надо накопить
- int x = 0; // храним на базе
- int y = 0; // стоимость хранилища
- int z = 0; // может хранить хранилище
- int m = 0; // время между привозами
- int s = 0; // колво привезенных деняк
- int f = 0; // стоимость пехоты
- int e = 0; // отрядов врага
- int t = 0; // время добираться
- cin >> c >> x >> y >> z >> m >> s >> f >> e >> t;
- int count = 0;
- int time = 0;
- int cxr = 0;
- while(count < c){
- time += m;
- count += s;
- if(count >= y && z * cxr + x < c){
- while(z * cxr + x < c && count >= y){
- count -= y;
- cxr++;
- }
- }
- }
- count = 0;
- int np = 0;
- int time1 = 0;
- while(np <= e){
- time1 += m;
- count += s;
- if(count >= f){
- np += count / f;
- count -= (count / f) * f;
- }
- }
- time1 += t;
- cout << min(time, time1) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement