답안 #1119000

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1119000 2024-11-26T13:04:53 Z Dan4Life Rack (eJOI19_rack) C++17
100 / 100
84 ms 504 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, k;
const int MOD = (int)1e9+7;
int poww(int a, int b){
	if(!b) return 1;
	int x = poww(a,b/2);
	x*=x, x%=MOD;
	if(b&1) x*=a, x%=MOD;
	return x;
}
int32_t main(){
	cin >> n >> k;
	int l = 1, r = poww(2,n);
	while(n--){
		if(k%2) k/=2, k++, r-=poww(2,n),r+=MOD,r%=MOD;
		else k/=2, l+=poww(2,n),l%=MOD;
	}
	cout << l << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 504 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 504 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 504 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 4 ms 340 KB Output is correct
15 Correct 84 ms 504 KB Output is correct