답안 #1001304

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1001304 2024-06-18T18:31:59 Z vjudge1 Rack (eJOI19_rack) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>

using namespace std;



int main()
{
    long long n,k;
    cin>>n>>k;
    long long res=1;
    for(long long n1=n;n1>0;n1--)
    {
        res=res*2;
    }
    if(k==1)
    {
        cout<<1;
        return 0;

    }

    k--;
    for(long long br=1;;br=br*2)
    {
        if(k<=br)
        {
            int br2=br/2,br3;
            if(k%2==0)
            {
                br3=br2+k/2;
            }
            else
            {
                br3=k/2;
            }
            if(br3==0)
                br3++;
            res=res/br;
            cout<<res*(br3-1)+res/2+1;
            return 0;

        }
        else
            k=k-br;
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -