Toggle navigation
Images.Elk.pl
655 Gray code
#include
#include
using namespace std;
#define Ptl(cm,cn,co) for (int bb = co , cm= cn ; cm<= bb; ++cm)
void Grejowanie();
std:: string TabNa10[10000];
int main()
{
Grejowanie();
int tst, bt;
scanf("%d",&tst);
while(tst--)
{
scanf("%d",&bt);
if(bt == 1) printf("0\n1\n");
else
{
int x = ( (( 1-(2<<(bt-2) )<< 1 )*(-1)));
int y = x + (2<<(bt-1))-1;
Ptl(cm, x, y)printf("%s\n",TabNa10[cm].c_str());
}
printf("\n");
}
}
void Grejowanie()
{
int pos = 2,uxa,pospos;
TabNa10[0] = "0";
TabNa10[1] = "1";
Ptl(cm, 1, 11)
{
uxa = 2<<(cm-1);
pospos =pos+(2<
Ptl(re, pos, pos+uxa-1)
{
TabNa10[re] = '0' + TabNa10[re-uxa];
TabNa10[pospos--] = '1' + TabNa10[re-uxa];
}
pos += (2<
}
}
Wyszukiwarka
Podobne podstrony:
vi tutorial QWERTY Gray
Dobie Gray nie żyje
bltin code objects
Gray, Muriel [SS] Shite Hawks [v1 0]
Static Analysis of Binary Code to Isolate Malicious Behaviors
MSP430x13x, MSP430F14x, MSP430F15x, MSP430F16x Code Examples TI COM ?T140?molist C
Cranberries Songs in red and gray
TAG CODE SETS
BMW?x Code List
06 sil gray
Gray Butley
Bro Code v 0 1 BETA ?rney
więcej podobnych podstron