Submission #269982

#TimeUsernameProblemLanguageResultExecution timeMemory
269982JuliusMieliauskasRack (eJOI19_rack)C++14
40 / 100
1 ms384 KiB
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define vi vector<int> #define vll vector<long long> #define MOD 1000000007 #define endl '\n' typedef long long ll; void print(vi v){ cout<<"Contents of vector:\n"; for(auto x : v) cout<<x<<" "; cout<<endl<<endl; } void solve(){ ll n, k; cin>>n>>k; string s = ""; k--; for(int i = 0; i<n; i++){ if (k & (1<<i)) { s += '1'; } else { s += '0'; } } //reverse(all(s)); //cout<<"S: "<<s<<endl; ll ans = stoll(s, nullptr, 2); cout<<ans+1<<endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); //ifstream cin("input.txt"); ofstream cout("output.txt");///cia failai //int T; cin>>T; int T = 1; for(int it = 1; it<=T; it++){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...