Submission #581036

# Submission time Handle Problem Language Result Execution time Memory
581036 2022-06-22T08:39:17 Z Banan Rack (eJOI19_rack) C++17
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define double long double
#define endl '\n'
#define sz size
#define pb push_back
#define fs first
#define sc second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
int const INF = LONG_LONG_MAX;

int n, k;

int bp(int x)
{
    int res=1, a=2;
    while(x)
    {
        if(x&1)res*=a;
        a*=a;
        x>>=1;
    }
    return res;
}

void solve()
{
    cin>>n>>k;
    int ans=0;
    int val=bp(n);
    while(k)
    {
        if(k%2==0){ans+=(val/2);}else{ans++;}
        k/=2;
        val/=2;
    }
    cout<<ans<<endl;
}

int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int tc=1;
    //cin>>tc;
    while(tc--)
    {
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -