Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <algorithm>
- #include <cmath>
- #include <vector>
- #include <string>
- #include <set>
- #include <stack>
- #include <queue>
- #include <deque>
- using namespace std;
- #define TASK "path"
- int main() {
- #ifdef _DEBUG
- freopen("debug.in", "r", stdin);
- freopen("debug.out", "w", stdout);
- #else
- //freopen(TASK".in", "r", stdin);
- //freopen(TASK".out", "w", stdout);
- //freopen("input.txt", "r", stdin);
- //freopen("output.txt", "w", stdout);
- #endif // _DEBUG
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- cout.precision(6);
- int st, n;
- cin >> st >> n;
- vector < int > a, b;
- a.push_back(st);
- for (int k = 0; k < n; k++) {
- for (int i = 0; i < a.size(); i++) {
- cout << a[i] << " ";
- }
- cout << "\n";
- int now = a[0], kol = 1;
- for (int i = 1; i <= a.size(); i++) {
- if (i == a.size() || a[i] != now) {
- b.push_back(kol);
- b.push_back(now);
- if (i != a.size()) {
- now = a[i], kol = 1;
- }
- continue;
- }
- kol++;
- }
- a = b;
- b.clear();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement