Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- #include <vector>
- using namespace std;
- void a (vector <int> * vec)
- {
- int x = (*vec)[(*vec).size()-1];
- for (int i = (*vec).size()-1; i > 0; --i)
- (*vec)[i] = (*vec)[i-1];
- (*vec)[0] = x;
- return;
- }
- void b (vector <int> * vec)
- {
- int x = (*vec)[2];
- for (int i = 2; i > 0; --i)
- (*vec)[i] = (*vec)[i-1];
- (*vec)[0] = x;
- return;
- }
- void wypisz (vector <int> wektor)
- {
- for (int i = 0; i < wektor.size(); ++i)
- printf("%i", wektor[i]);
- printf("\n");
- return;
- }
- int pozycja (vector <int> wektor, int szukana)
- {
- for (int i = 0; i < wektor.size(); ++i)
- if (wektor[i] == szukana) return i;
- return -1;
- }
- int main ()
- {
- int n;
- scanf("%i", &n);
- vector <int> tab;
- string out("");
- for (int i = 0; i < n; ++i)
- {
- int x;
- scanf("%i", &x);
- tab.push_back(x);
- }
- for (int i = 2; i <= n; ++i)
- {
- if (pozycja(tab, i) == pozycja(tab, i-1)) continue;
- while (pozycja(tab, i) != (pozycja(tab, i-1)+1) || pozycja(tab, i) != (pozycja(tab, i-1)-7))
- {
- while (pozycja(tab, i) != 2)
- {
- a(&tab);
- out += "a";
- }
- if (pozycja(tab, i-1) == n-2)
- {
- a(&tab);
- out += "a";
- b(&tab);
- out += "b";
- }
- else
- {
- b(&tab);
- }
- }
- }
- counter = 0;
- for (int i = 0; i < out.length(); ++i)
- {
- int acount = 0, bcount = 0;
- bool isa;
- if (out[i] == 'a')
- {
- acount++;
- if (i == 0)
- isa = true;
- else if (
- else
- {
- bcount++;
- if (
- }
- for (int i = 0; i <
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement