/*
:---:--:--::::::--:-:----:
::-:::. ::-:::
.* -===.. :---
.-+*##=-------====-: :--:
:+##=.* -= :=+- .-=:
.+++-. :- -=. .=+- .--.
.++=- + -= :*- :-.
+*+- :- -=. -*: :=:
#*: * -=. +- .=
=:%+ -: -=. +- --
-%: * -=. *: +.
:%-.. =. -=. # -:
:=# .. + -=. == -=
---+ . = -=. .# .+
-: == . = :------::------:.-=. % .=
:- == .=. ---:. :--#+. .% :-
= .* .+.. :=- :++ -+ =:
+ #. + -=: :*%-*: *
:= :# :=:= . :-----: =+-+ .+
* -* *=- . .- :::::::. :* .#+. +
:- -+ :#. --::-----: :* ++= .-
+ :*. *. .:::::*%: ++ +.-=. +
+ -#**----: .= -*. + -= =
* +.#=+: + . .=+: =. -=. =
= -+ :++: + .. .=+= .= -=. -
= %- :====-:. =. .:--===- * -=. -
+ +-- .:--==#==-:.= + -=. =
* + * =. : .= -=. =
+ = * + = -=. +
:- = .= =: = -=. .-
* + =: * * -=. +
:- .+ =- :- .+ -=. .+
* * := * := -= *
= :- =: .- .=: -=. =:
-: * .=- + .=- -= :-
=: -: --: :- :--: -=. .=
=:+ ----. * :---. -= .+
--=*----------------------=*+=--=+--=+*+------------------------------------------------%+:.
:: := +:- -- :.
.=. =.
-= -=
.=: .=.
.=: .+:
:-- :-:
-- -=.
:--. --:
:--: .--:
.-:-: ::--.
:----. .:----
.:::::::::-::::::--::::::::.
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define debug(x) cerr << #x << " is " << x << "\n"
#define hehe ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repb(i, a, b) for (int i = b; i >= a; i--)
#define pii pair<int, int>
#define linebreak cout << "---------------------------------------------------------\n"
#define f first
#define s second
#define pb push_back
// good luck
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
const int MS = 1e6+5, mod = 1e9+7;
int n, k;
int32_t main() {
cin >> n >> k;
int ans = 0;
k--;
for (int i = 0; i < n; i++) {
ans = (2*ans+k%2)%mod;
k /= 2;
}
cout << (ans+1)%mod;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
5 ms |
432 KB |
Output is correct |