Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4. int c = 0; // надо накопить
  5. int x = 0; // храним на базе
  6. int y = 0; // стоимость хранилища
  7. int z = 0; // может хранить хранилище
  8. int m = 0; // время между привозами
  9. int s = 0; // колво привезенных деняк
  10. int f = 0; // стоимость пехоты
  11. int e = 0; // отрядов врага
  12. int t = 0; // время добираться
  13. cin >> c >> x >> y >> z >> m >> s >> f >> e >> t;
  14. int count = 0;
  15. int time = 0;
  16. int cxr = 0;
  17. while(count < c){
  18. time += m;
  19. count += s;
  20. if(count >= y && z * cxr + x < c){
  21. while(z * cxr + x < c && count >= y){
  22. count -= y;
  23. cxr++;
  24. }
  25. }
  26. }
  27. count = 0;
  28. int np = 0;
  29. int time1 = 0;
  30. while(np <= e){
  31. time1 += m;
  32. count += s;
  33. if(count >= f){
  34. np += count / f;
  35. count -= (count / f) * f;
  36. }
  37. }
  38. time1 += t;
  39. cout << min(time, time1) << endl;
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement