Untitled

mail@pastecode.io avatar
unknown
plain_text
17 days ago
669 B
1
Indexable
Never
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    long long a, b,n=1;
    cin >> a >> b;
    long long mmb=pow(2,a);
    long long corrupted[mmb],lethal[mmb];
    for (int f=1; f<=mmb; f++)
    {
        corrupted[f]=n;
        n++;
    }
    n=1;
    long long m=mmb,dem1=1,dem2=mmb;
    lethal[1]=1;
    lethal[mmb]=2;
    for (int i=1; i<=(mmb/2)-1; i++)
    {
        lethal[n+dem1]=dem2;
        dem2--;
        lethal[m-dem1]=dem2;
        dem1++;
    }
    for (int y=1; y<=mmb; y++)
    {
        if (lethal[y]==b)
        {
            cout << y;
            break;
        }
    }

    return 0;
}
Leave a Comment