이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int mod = 1e9+7;
ll mpow(ll b, ll p) {
if (p == 0) return 1;
ll a = mpow(b, p/2)%mod;
if (p%2 == 0) return (a*a)%mod;
return (((a*a)%mod)*b)%mod;
}
int main() {
ll n, k; cin >> n >> k;
ll ans = 0;
for (int i = 1; i <= n; ++i) {
if (k%2) k = (k+1)/2LL;
else {
k = k/2LL;
ans += mpow(2, n-i);
ans %= mod;
}
}
cout << (ans+1)%mod << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |