#include <stdio.h>
#define MOD 1000000007ll
#define N 1000005
int p2[N];
long long n, k;
long long a(long long k,long long l,long long r,int d)
{
if(d==n)return 1;
if(k&1) return a((k+1)/2, l, r-1, d+1) % MOD;
else return (a(k/2, l+1, r, d+1) + p2[n-1-d]) % MOD;
}
int main()
{
p2[0]=1;for(int i=1;i<N;++i)p2[i]=(p2[i-1]<<1)%MOD;
scanf("%lld%lld",&n,&k);
printf("%lld",a(k,0,n,0));
}
Compilation message
rack.c: In function 'main':
rack.c:18:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
18 | scanf("%lld%lld",&n,&k);
| ^~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4188 KB |
Output is correct |
2 |
Correct |
5 ms |
4120 KB |
Output is correct |
3 |
Correct |
5 ms |
4188 KB |
Output is correct |
4 |
Correct |
5 ms |
4124 KB |
Output is correct |
5 |
Correct |
5 ms |
4184 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4188 KB |
Output is correct |
2 |
Correct |
5 ms |
4120 KB |
Output is correct |
3 |
Correct |
5 ms |
4188 KB |
Output is correct |
4 |
Correct |
5 ms |
4124 KB |
Output is correct |
5 |
Correct |
5 ms |
4184 KB |
Output is correct |
6 |
Correct |
5 ms |
4188 KB |
Output is correct |
7 |
Correct |
5 ms |
4188 KB |
Output is correct |
8 |
Correct |
5 ms |
4380 KB |
Output is correct |
9 |
Correct |
5 ms |
4188 KB |
Output is correct |
10 |
Correct |
5 ms |
4188 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4188 KB |
Output is correct |
2 |
Correct |
5 ms |
4120 KB |
Output is correct |
3 |
Correct |
5 ms |
4188 KB |
Output is correct |
4 |
Correct |
5 ms |
4124 KB |
Output is correct |
5 |
Correct |
5 ms |
4184 KB |
Output is correct |
6 |
Correct |
5 ms |
4188 KB |
Output is correct |
7 |
Correct |
5 ms |
4188 KB |
Output is correct |
8 |
Correct |
5 ms |
4380 KB |
Output is correct |
9 |
Correct |
5 ms |
4188 KB |
Output is correct |
10 |
Correct |
5 ms |
4188 KB |
Output is correct |
11 |
Correct |
5 ms |
4184 KB |
Output is correct |
12 |
Correct |
6 ms |
4340 KB |
Output is correct |
13 |
Correct |
5 ms |
4444 KB |
Output is correct |
14 |
Correct |
6 ms |
5916 KB |
Output is correct |
15 |
Correct |
29 ms |
34728 KB |
Output is correct |