Esempio n. 1
0
int main()
{
	int i,j,k;
	while(scanf("%d%d",&h,&w)!=EOF)
	{
		if(h==0&&w==0)break;
		if((h*w)%2==1)
		{
			printf("0\n");
			continue;
		}
		memset(dp,0,sizeof(dp));
		for(i=0;i<(1<<w);i++)
		{
			if(ok1(i))
				dp[0][i]=1;
		}
		for(i=1;i<h;i++)
		{
			for(j=0;j<(1<<w);j++)
			{
				for(k=0;k<(1<<w);k++)
				{
					if(ok2(j,k))
						dp[i][j]+=dp[i-1][k];
				}
			}
		}
		printf("%lld\n",dp[h-1][(1<<w)-1]);
	}
	return 0;
}
Esempio n. 2
0
void
prim_ext_name_okp(PRIM_PROTOTYPE)
{
    /* These are function pointers */
    int (*ok1) (const char *) = NULL;
    int (*ok2) (const char *) = NULL;

    CHECKOP(2);
    oper2 = POP();
    oper1 = POP();

    if (oper1->type != PROG_STRING)
	abort_interp("Object name string expected (1).");
    if (!oper1->data.string)
	abort_interp("Cannot be an empty string (1).");

    if (oper2->type == PROG_STRING) {
	if (!oper2->data.string)
	    abort_interp("Cannot be an empty string (2).");
	strcpyn(buf, sizeof(buf), oper2->data.string->data);
	for (ref = 0; buf[ref]; ref++)
	    buf[ref] = tolower(buf[ref]);
	if (!strcmp(buf, "e") || !strcmp(buf, "exit")) {
	    ok1 = ok_ascii_other;
	    ok2 = ok_name;
	} else if (!strcmp(buf, "r") || !strcmp(buf, "room")) {
	    ok1 = ok_ascii_other;
	    ok2 = ok_name;
	} else if (!strcmp(buf, "t") || !strcmp(buf, "thing")) {
	    ok1 = ok_ascii_thing;
	    ok2 = ok_name;
	} else if (!strcmp(buf, "p") || !strcmp(buf, "player")) {
	    ok1 = ok_player_name;
	} else if (!strcmp(buf, "f") || !strcmp(buf, "muf")
		   || !strcmp(buf, "program")) {
	    ok1 = ok_ascii_other;
	    ok2 = ok_name;
	} else {
	    abort_interp("String must be a valid object type (2).");
	}
    } else if (oper2->type == PROG_OBJECT) {
	if (!valid_object(oper2))
	    abort_interp("Invalid argument (2).");
	switch (Typeof(oper2->data.objref)) {
	case TYPE_EXIT:
	case TYPE_ROOM:
	case TYPE_PROGRAM:
	    ok1 = ok_ascii_other;
	    ok2 = ok_name;
	    break;
	case TYPE_THING:
	    ok1 = ok_ascii_thing;
	    ok2 = ok_name;
	    break;
	case TYPE_PLAYER:
	    ok1 = ok_player_name;
	    break;
	}

    } else {
	abort_interp("Dbref or object type name expected (2).");
    }

    result = ok1 && ok1(oper1->data.string->data);
    if (ok2 && result)
	result = ok2(oper1->data.string->data);
    CLEAR(oper1);
    CLEAR(oper2);
    PushInt(result);
}
Esempio n. 3
0
bool AvlTree<T, M>::ok()
{
	return Super::ok() && ok1(Super::root) && ok2(Super::root);
}
Esempio n. 4
0
int main(int argc, char *argv[])
{
	SDL_Init(SDL_INIT_EVERYTHING);
		
	ekran = SDL_SetVideoMode( 800, 600, 32, SDL_SWSURFACE );
	DrawableSDL::surface = ekran;
    SDL_Flip( ekran );
	SDL_CDOpen(0);
	ekran->pixels;
	SDL_Event e;
	int frame_time;
	SDL_PollEvent(&e);

	FontFactory::initializeFont("simplePix", "pixelart.ttf", 10);

	SDL_Rect rect;
	rect.x=100;
	rect.y=10;
	rect.w=100;
	rect.h=100;

	TTF_Init();

	Rectangle object1;
	object1.setColor(0xff, 0xff, 0xff);
	
	Rectangle object2;
	object2.setColor(0xf1, 0x00, 0xda);
	object2.setX(50);

	object1.setX(10);

	Container helping(100,30);
	//helping.add(&object1);

	Container root(10,10);

	SimpleScrollBar scroll(100, 100, 10, 150, 0, 1000, Orientation::horizontal);
	SimpleScrollBar scroll2(100, 85, 10, 150, 0, 1000, Orientation::horizontal);
	root.add(&scroll);
	Button ok(100, 100, 60, 20, "Here i am");
	ok.setBorderSize(2);
	ok.setBackground(255,225,255);
	ok.setBorderColor(10,100,10);
	ok.setFontName("simplePix");
	smth e_inst;
	ok+= *(new Delegate(&e_inst));

	Button ok2(200, 200, 80, 20, "I am not here");
	ok2.setBorderSize(2);
	ok2.setBackground(255,225,255);
	ok2.setBorderColor(10,100,10);
	ok2.setFontName("simplePix");
	root.add(&ok);
	root.add(&scroll2);
	root.add(&ok2);
	//ok.setEnable(false);

	ListBoxElementSDL el(50);
	el.setText("hello");
	el.setSelection(false);
	el.cut(4, down);
	ListBoxElementSDL el1(50);
	el1.setText("welcome");
	el1.setSelection(false);
	ListBoxElementSDL el2(50);
	el2.setText("hejo");
	el2.setSelection(false);
	ListBoxElementSDL el3(50);
	el3.setText("hejo2");
	ListBoxElementSDL el4(50);
	el4.setText("hejo1");
	ListBoxElementSDL el5(50);
	el5.setText("hejo3");
	ListBoxElementSDL el6(50);
	el6.setText("Witam");
	ListBoxElementSDL el7(50);
	el7.setText("Witam");

	ListBoxSDL list(500, 200, 100, 50, 2);
	list.add(&el);
	list.add(&el1);
	list.add(&el2);
	list.add(&el3);
	list.add(&el4);
	list.add(&el5);
	list.add(&el6);
	list.add(&el7);
	root.add(&list);
	MovingRectangle movrect;
	MovingRectangle movrect2;
	movrect2.setColor(0x43, 0x52, 0xFF);

	//root.add(&movrect);
	//root.add(&movrect2);
	Uint32 color = SDL_MapRGB(ekran->format, 0xff, 0xff, 0xff);
	Uint32 color2 = SDL_MapRGB(ekran->format, 0x00, 0xff, 0xff);
	short int r=0,g=0,b=0;
	while(true)
	{
		frame_time = SDL_GetTicks();
		ok.setX(scroll.getValue());
		ok.setY(scroll2.getValue());
		SDL_FillRect(ekran, &(ekran->clip_rect), color2);
		root.draw(0,0);

		if(SDL_PollEvent(&e))
		{
			if(e.type == SDL_QUIT)
			{
				SDL_Quit();
				return 0;
			}
			root.spreadEvent(e);
		}
		SDL_Flip(ekran);
		if((SDL_GetTicks() - frame_time) < 1000/FPS)
			SDL_Delay(1000/FPS - (SDL_GetTicks() - frame_time));

	}


	return 0;
}
Esempio n. 5
0
bool AvlTree<T, M>::ok2(Node* k)
{
	if (k == 0) return true;
	if ((height(k->left) - height(k->right)) != k->balance) return false;
	return ok2(k->left) && ok2(k->right);
}