이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// European Junior Olympiad in Informatics 2019
// Maribor, Slovenia, Day 1: rack
#include <iostream>
using namespace std;
const long int mod = 1000000007;
int n = 1;
int k = 1;
int i = 1;
int r = 1; // (just wanna make my code longer)
int pow2(int x) {
if (!x) {
return 1;
}
if (x & 1) {
return 2 * pow2(x / 2) % mod * pow2(x / 2) % mod;
}
return (pow2(x / 2) * pow2(x / 2) % mod);
}
signed main() {
cin >> n >> k;
for (i = n - 1; i >= 0; i--) {
if (k & 1) k++;
else r = (r + pow2(i)) % mod;
k = (k + 1) / 2;
}
cout << r << 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... |