Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- #define speed ios_base::sync_with_stdio(0); cin.tie(0);
- #define mx 1000000000
- using namespace std;
- //////////// ////// ////// /////////////////
- //// /// //////// //////// /// //
- /// /// /// /// /// /// ///
- /// /// /// /// /// /// ///
- /// /// /// /// /// /// /////////
- //////////////// /// ///// /// ///
- /// /// /// /// ///
- /// /// /// /// /// //
- /// /// /// /// /////////////////
- int main()
- {
- //ЗАДАЧА 2
- cout << "vvedite posledovatelnost \n";
- int count = 0;
- string input1 = "";
- vector<bool> a;
- while (getline(cin, input1))
- {
- if (input1.empty())
- {
- break;
- }
- int tmp = stoi(input1);
- if (tmp>0)
- {
- a.push_back(true);
- }
- else if(tmp < 0)
- {
- a.push_back(false);
- }
- }
- for (int i = 1; i < a.size(); i++)
- {
- if(a[i] != a[i-1])
- {
- count++;
- }
- }
- cout << "vsego znak menalsa " << count << " raz(a)" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement