#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<queue>
#include<map>
using namespace std;
#define PB push_back
#define INS insert
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define nMax 1010
#define bug puts("Fuck");
int dp[nMax][3];
void f(int n,int k){
if(n == 0) {
printf ("\n");
return ;
}
// printf("%d %d %d %d %d\n",n,k,dp[n][2],dp[n][1],dp[n][0]);
if(k > dp[n][2] - dp[n][1]){
printf("1");
k -= (dp[n][1]+dp[n-1][1] );
f(n-1,k);
return ;
}
else {
printf("0");
//k -= (dp[n][1] + dp[n][0]);
f(n-1,k);
return ;
}
}
int main(){
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
int n , k;
while(~scanf("%d%d",&n,&k)){
memset(dp,0,sizeof(dp));
dp[0][0] = 1;dp[0][1] = 0,dp[0][2] = 1;
// bug
for(int i=1;i<=n;i++){
dp[i][0] = dp[i-1][1] + dp[i-1][0] ;
dp[i][1] = dp[i-1][0];
dp[i][2] = dp[i][1] + dp[i-1][2] ;
// printf ("%d %d\n",i,dp[i][2]);
}
// bug
if(k > dp[n][2]) printf("-1\n");
else f(n,k);
}
return 0;
}
Ural 1635
最新推荐文章于 2018-05-17 10:49:01 发布