Untitled

 avatar
user_5811307
plain_text
2 months ago
1.4 kB
0
Indexable
Never
#include <iostream>
#include <cmath>
#include <string>
#include <vector>

using namespace std;

int attac(vector<int> &wall_health, vector<int> &orgi_attac )
{
    bool stoit =1;
    int a = orgi_attac.size();

    for(int i =0; i <= a; i++)
    {
        wall_health[orgi_attac[i]] -=1;
        if(wall_health[orgi_attac[i]] ==0)
        {
            stoit= false;
            return stoit;
        }
    }
}

int main()
{
    vector<int> wall_health;
    vector<int> orgi_attac;
    int wall_length, helth, num_of_zalp;
    cout << "wall leanght" << endl;
    cin >>wall_length;
    for(int i =0; i< wall_length; i++)
    {
        cout << "wall " << i+1 << " health " <<  endl;
        cin >> helth;
        wall_health.push_back(helth);
    }

    cout << "Number of org zalp: " << endl;
    cin >> num_of_zalp;



    for(int i =0; i < num_of_zalp;i++)
    {
        int size_of_zalp;
        cout << "size_of_zalp" << endl;
        cin >> size_of_zalp;
        for(int j =0; j < size_of_zalp;j++)
        {
            int attacc;
            cout << "Zalp number " << j+1 << endl;
            cin >> attacc;
            orgi_attac.push_back(attacc);
        }

        if(attac(wall_health, orgi_attac) == 0){
            cout << "BAN";
            return 0;
        }

    }

    for(int i = 0; i < wall_length;i++)
    {
        cout << wall_health[i] << " ";
    }

}
Leave a Comment