Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <cstdio>
- #include <vector>
- #include <cmath>
- #include <string>
- #include <algorithm>
- #include <string>
- #include <deque>
- #include <iomanip>
- #include <cstddef>
- #define F first
- #define S second
- using namespace std;
- const long double eps = 0.000000005;
- const long double pi = 3.1415926535897932;
- const long long inf = 1e9;
- deque<int> a;
- int main()
- {
- ios_base::sync_with_stdio(0);
- //freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
- // freopen("slalom.in", "r", stdin);freopen("slalom.out", "w", stdout);
- int n;
- cin >> n;
- for (int i = 0; i < n; i++)
- a.push_back(1);
- int ans = 0;
- while (a.size() > 1)
- {
- if (a.front() == 1)
- {
- a.pop_front();
- a.pop_front();
- a.push_back(2);
- a.push_back(3);
- }
- else
- if (a.front() == 2)
- {
- a.pop_front();
- a.pop_front();
- a.push_back(1);
- }
- else
- {
- a.pop_front();
- a.pop_front();
- a.push_back(1);
- a.push_back(1);
- a.push_back(1);
- }
- ans++;
- }
- cout << ans
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement