记录编号 |
595781 |
评测结果 |
AAAAAAAAAAAAAAAAAAAA |
题目名称 |
[CSP 2019S]格雷码 |
最终得分 |
100 |
用户昵称 |
┭┮﹏┭┮ |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.058 s |
提交时间 |
2024-10-16 22:04:08 |
内存使用 |
3.35 MiB |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define pii pair<int,int>
#define fi first
#define in inline
#define se second
#define mp make_pair
#define pb push_back
const int N = 1e5+10;
ll read(){
ll x = 0,f = 1;char c = getchar();
for(;c < '0' || c > '9';c = getchar())if(c == '-')f = -1;
for(;c >= '0' && c <= '9';c = getchar())x = (x<<1) + (x<<3) + c-'0';
return x * f;
}
__int128 n,k,p[70] = {1};
int main(){
freopen("2019code.in","r",stdin);
freopen("2019code.out","w",stdout);
n = (__int128)read(),k = (__int128)read() + 1;
for(int i = 1;i <= n;i++)p[i] = p[i-1] * 2;
for(int i = n;i >= 1;i--)
if(k > p[i-1])printf("1"),k = p[i] - k + 1;
else printf("0");
printf("\n");
return 0;
}