제출 #232150

#제출 시각아이디문제언어결과실행 시간메모리
232150Dremix10Rack (eJOI19_rack)C++17
100 / 100
5 ms384 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll expo(ll x, ll n, ll m){ if(n==0)return 1; ll u=expo(x,n/2,m); u=(u*u)%m; if(n%2)u=(u*x)%m; return u; } int main (){ long long n,k; cin>>n>>k; n--; long long start; if(n>59) start=1; else{ ll temp=1e18; ll res=expo(2,n,temp); if(k<=res) start=1; else{ start=2; k-=res; } } //cout<<start<<endl; int mod=1e9+7; while(k>(ll)1){ if(k%2){ k/=2; k++; } else{ k/=2; start+=expo(2,n,mod); start%=mod; } n--; } cout<<start<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...