이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define pii pair<int, int>
#define xx first
#define yy second
#define MOD 1000000007
using namespace std;
ll n, k, ress;
ll dvaNa[1000010];
int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin>>n>>k;
k--;
dvaNa[0]=1;
for (int i=1; i<=n+1; i++) dvaNa[i]=(dvaNa[i-1]*2)%MOD;
int i=0;
while (k)
{
int cif=k%2; k/=2;
ress=(ress+(cif*(dvaNa[n-1-i])%MOD)%MOD)%MOD;
i++;
}
cout<<(ress+1)%MOD;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |