Вітаю Вас, Гість

Задача С. Скрипник Денис

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    vector<int> l, r, c, p;
    ll n, k, i, j, jr,jl;
    cin >> n >> k;
    p.resize(n);
    for ( i = 0;i<n;++i){
        cin >> p[i];
    }
    r.resize(n/2);
    l.resize((n+1)/2);
    c = p;
    for ( i = 1;i<=k;++i ){
        jr = jl = 0;
        for ( j = 0;j<n;++j){
            if ( (j % 2) != 0 )
                r[jr++] = c[j];
            else
                l[jl++] = c[j];
        }
        copy(r.rbegin(), r.rend(), c.begin());
        copy(l.rbegin(), l.rend(), c.begin() + r.size());
        if ( c == p )
            i = (k/i)*i;
    }
    for_each(c.begin(), c.end(),[] (int x){
        cout << x << '\n';
    });
}

 

Задача D. Акуліч Даниїл

#include <iostream>
#include <queue>
using namespace std;
int c,c2,n,c3,a,b,k;
int element[2];
queue <int> q;
int main()
{
q.push(1);
q.push(1);
cin>>k;
while (q.size()>0)
{
    a = q.front();
    q.pop();
    b = q.front();
    q.pop();
    cout<<a<<"/"<<b<<" ";
    if (a+b<=k)
        {
        q.push(a);
        q.push(a+b);
        q.push(a+b);
        q.push(b);
        }
}
    return 0;
}

 

Задача Е. Мисечко Артемій

#include <iostream>

using namespace std;

struct Tstr{
    string tabl[60];
};
struct high_wid
{
    long high, width;
};

struct lom{
    long num[200];
};

lom poly_high[4000];
Tstr s[200];
long high[4000];
high_wid mas[200];
char field[4000][4000];

int main()
{
    long w, h, k, x1,x2,m,n, max_high,counter;
    cin >> w >> h;
    cin >> k;
    for (long i = 1;i <= h; ++i)
        for (long j = 1; j <= w; ++j)
            field[i][j] = '.';
    for (long i = 1; i <= k; ++i){
        cin >> mas[i].width >> mas[i].high;
        for (long j = 1;j <= mas[i].high; ++j)
            cin >> s[i].tabl[j];
        for (long g = 0;g < mas[i].width; ++g){
            counter = 0;
            for (long j = mas[i].high;j > 0; --j)
                if (s[i].tabl[j][g] == '#')
                    break;
                else
                    ++counter;
            poly_high[i].num[g+1] = counter;
        }
    }
    long index;
    cin >> n;
    for (long i = 1;i <= n; ++i)
    {
        cin >> m >> x1 >> x2;
        max_high = 0;
        index = x1;
        for (long j = x1;j <= x2; ++j){
            if (high[j] - poly_high[m].num[j-x1+1] > max_high)
            {
                max_high = high[j] - poly_high[m].num[j-x1+1];
                index = j;
            }
        }
        long ptu;
        for (long j = x1;j <= x2; ++j){
            for (long g = 1;g <= mas[m].high-poly_high[m].num[j-x1+1]; ++g){
                field[h-max_high-mas[m].high+g][j] = s[m].tabl[g][j-x1];
            }
            ptu = h-(max_high + mas[m].high)+1;
            while (ptu <= h && field[ptu][j] == '.')
                ++ptu;
            if (ptu > h)
                high[j] = 0;
            else
                high[j] = h - ptu + 1;
        }

    }
    for (long i = 1;i <= h;++i){
        for (long j = 1;j <= w; ++j)
            cout << field[i][j];
        cout << '\n';
    }
}