1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include<iostream>
#include<stack>
using namespace std;

int first;

void wyswietl(int a)
{
 if(a>=first)
 {
  first=a+1;
 }
 else first=a;
 switch(first)
 {
  case 0:
  cout<<'a';
  break;

  case 1:
  cout<<'b';
  break;

  case 2:
  cout<<'c';
  break;
 }
}
int main()
{
int long long n;
int long long k;
cin>>n;
cin>>k;
if(n>59 || k<(1<<(n) ))
{
first=0;
cout<<'a';
}
else
{
 if(k<(1<<(n+1))-1 )
 {
  first=1;
  cout<<'b';
  k-=(1<<(n))-1;
 }
 else
 {
  if(k<3*(1<<(n))-2)
  {
   first=2;
   cout<<'c';
   k-=((1<<(n+1))-2);

  }
  else
  {
   cout<<"NIE";
   return 0;
  }
 }
}
n--;
while(n>0)
{
 if(k==1) break;
 if(k>(1<<n)) {wyswietl(1); k-=(1<<n);}
 else {wyswietl(0);k--;}
 n--;
}


return 0;
}