#include <bits/stdc++.h>
using namespace std;
//i/o optimisations
#define endl "\n"
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//data types & structures
typedef long long ll;
#define pq priority_queue
//graph structures
typedef vector<pair<ll,ll>> graph;
typedef vector<ll> nw_graph;
typedef pq<pair<ll,ll>> dij_q;
//constant values
const ll N=2e5+1;
const ll N6=1e6+1;
const ll INF=1e9+1;
const ll LOGN=18;
//operations
#define MID ((l+r)/2)
#define RANGE (r-l+1)
//pairs
#define f first
#define s second
//output
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
int main(){
fastio;
ll n, k;
cin>>n>>k; k--;
ll ans=0;
for(ll i=0; i<n; i++){
if(k&1<<i){
ans+=1<<(n-i-1);
}
}
cout<<ans+1;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
600 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
600 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |