Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int c, x, y, z, m, s, f, e, t;
- int limit, storage, army, time1, time2, temp1, temp2;
- x = 0;
- time1 = 0;
- time2 = 0;
- temp1 = 0;
- temp2 = 0;
- storage = 0;
- army = 0;
- cin >> c >> x >> y >> z >> m >> s >> f >> e >> t >> f >> y;
- if ((y <= x) and (f <= x)) {
- if (c <= x) {
- while (storage < c) {
- storage = storage + s;
- time1 = time1 + m;
- if (storage > x) {
- storage = x;
- }
- }
- }
- if (c > x) {
- if (y <= s) {
- while (x <= c) {
- storage = storage + s;
- x = x + z;
- storage = storage - y;
- time1 = time1 + m;
- if (storage > x) {
- storage = x;
- }
- };
- while (storage < c) {
- storage = storage + s;
- time1 = time1 + m;
- if (storage > x) {
- storage = x;
- }
- }
- }
- if (y > s) {
- temp1 = y / s;
- temp2 = y % s;
- if (temp2 > 0) {
- temp1 = temp1 + 1;
- }
- while (x < c) {
- storage = storage + s * temp1;
- x = x + z;
- storage = storage - y;
- time1 = time1 + m * temp1;
- if (storage > x) {
- storage = x;
- }
- }
- while (storage < c) {
- storage = storage + s;
- time1 = time1 + m;
- if (storage > x) {
- storage = x;
- }
- }
- }
- storage = 0;
- temp1 = 0;
- temp2 = 0;
- if (f <= x) {
- while (army <= e) {
- storage = storage + s;
- time2 = time2 + m;
- temp1 = storage / f;
- temp2 = temp1 * f;
- storage = storage - temp2;
- army = army + temp1;
- if (storage > x) {
- storage = x;
- }
- }
- time2 = time2 + t;
- if (f > x) {
- while (f > x) {
- if (y <= s) {
- while (x < c) {
- storage = storage + s;
- x = x + z;
- if (storage > x) {
- storage = x;
- }
- storage = storage - y;
- time2 = time2 + m;
- }
- storage = storage + s;
- time2 = time2 + m;
- temp1 = storage / f;
- temp2 = temp1 * f;
- storage = storage - temp2;
- army = army + temp1;
- if (storage > x) {
- storage = x;
- }
- }
- if (y > s) {
- temp1 = y / s;
- temp2 = y % s;
- if (temp2 > 0) {
- temp1 = temp1 + 1;
- }
- while (x < c) {
- storage = storage + s * temp1;
- x = x + z;
- storage = storage - y;
- time2 = time2 + m * temp1;
- if (storage > x) {
- storage = x;
- }
- }
- storage = storage + s;
- time2 = time2 + m;
- temp1 = storage / f;
- temp2 = temp1 * f;
- storage = storage - temp2;
- army = army + temp1;
- if (storage > x) {
- storage = x;
- }
- }
- }
- }
- }
- }
- else {
- cout << "Try again. System error - #1. Contact with developper - KSoft";
- }
- if (time1 < time2){
- cout << time1;
- }
- else {
- cout << time2;
- }
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement