Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么wa啊

Posted by xincen at 2010-09-26 16:05:06 on Problem 2965
#include<iostream>
using namespace std;
struct id
{
	int state;
	int num;
	int nMax[10];
} no[70000];
int covert(int a,int position)
{
	int i;
	a^=(1<<position);
	for(i=position%4;i<16;i+=4)
		a^=(1<<i);
	for(i=position/4*4;i<position/4*4+4;i++)
		a^=(1<<i);
	return a;
}
int main()
{
	int i=0,j=0,k=0,n=0;
	char ch;
	int current_id=0;
	for(i=0;i<16;i++)
	{
		cin>>ch;
		if(ch=='+')
			current_id+=1<<i;
	}
	int a,b,c;
	no[0].state=current_id;
	no[0].num=0;
	no[0].nMax[0]=-1;
	i=1;
	while(1)
	{
		cout<<"q";
		a=no[k].state,b=no[k].num,c=no[k].nMax[b];
		for(j=c+1;j<16;j++)
		{
			no[i].state=covert(a,j);
			no[i].num=b+1;
			no[i].nMax[b]=j;
			if(no[i].state==0||no[i].state==65535)
			{
				cout<<no[i].num<<endl;
				for(n=0;n<no[i].num;n++)
					cout<<no[i].nMax[n]/4+1<<" "<<no[i].nMax[n]%4+1<<endl;
				return 0;
			}
			i++;
						
		}
		k++;
	}
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator