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

inf的大小写!

Posted by frkstyc at 2006-03-21 22:24:14 on Problem 1681
In Reply To:用的1222一样的算法,为什么wa呢??? Posted by:cpp00446083 at 2006-03-21 22:23:02
> 贴代码,请有兴趣的人帮忙看一下:
> #include<stdio.h>
> #include<string.h>
> #define WALLSIZE 17
> 
> int main()
> {
> 	int t,n,MinPiant,NowPiant,Cases;
> 	int i,j,k,ii,tmp;
> 	char Wall[WALLSIZE][WALLSIZE],WallTmp[WALLSIZE][WALLSIZE];
> 
> 	scanf("%d",&t);
> 	for(i = 0;i < t;i ++)
> 	{
> 		MinPiant = 226;
> 		Cases = 1;
> 		scanf("%d",&n);
> 		for (j = 0;j < n;j ++)
> 		{
> 			scanf("%s",Wall[j + 1] + 1);
> 			Cases *= 2;
> 		}
> 		for (k = 0;k < Cases;k ++)
> 		{
> 			tmp = k;
> 			NowPiant = 0;
> 			for (j = 0;j < n ;j ++)
> 				strcpy(WallTmp[j + 1],Wall[j + 1]);
> 			for (j = 0;j < n;j ++)
> 			{
> 				if ((tmp % 2) == 1)
> 				{
> 					NowPiant ++;
> 					if (WallTmp[1][j + 1] == 'y')
> 						WallTmp[1][j + 1] = 'w';
> 					else WallTmp[1][j + 1] = 'y';
> 					if (WallTmp[1][j + 2] == 'y')
> 						WallTmp[1][j + 2] = 'w';
> 					else WallTmp[1][j + 2] = 'y';
> 					if (WallTmp[1][j] == 'y')
> 						WallTmp[1][j] = 'w';
> 					else WallTmp[1][j] = 'y';
> 					if (WallTmp[2][j + 1] == 'y')
> 						WallTmp[2][j + 1] = 'w';
> 					else WallTmp[2][j + 1] = 'y';
> 				}
> 				tmp = tmp / 2;
> 			}
> 			for (j = 1;j < n;j ++)
> 			{
> 				for (ii = 0;ii < n;ii ++)
> 					if (WallTmp[j][ii + 1] == 'w')
> 					{
> 						NowPiant ++;
> 						if (WallTmp[j + 1][ii + 1] == 'y')
> 							WallTmp[j + 1][ii + 1] = 'w';
> 						else WallTmp[j + 1][ii + 1] = 'y';
> 						if (WallTmp[j + 1][ii + 2] == 'y')
> 							WallTmp[j + 1][ii + 2] = 'w';
> 						else WallTmp[j + 1][ii + 2] = 'y';
> 						if (WallTmp[j + 1][ii] == 'y')
> 							WallTmp[j + 1][ii] = 'w';
> 						else WallTmp[j + 1][ii] = 'y';
> 						if (WallTmp[j][ii + 1] == 'y')
> 							WallTmp[j][ii + 1] = 'w';
> 						else WallTmp[j][ii + 1] = 'y';
> 						if (WallTmp[j + 2][ii + 1] == 'y')
> 							WallTmp[j + 2][ii + 1] = 'w';
> 						else WallTmp[j + 2][ii + 1] = 'y';
> 					}
> 			}
> 			for (j = 1;j < n + 1;j ++)
> 				if (WallTmp[n][j] == 'w')
> 					break;
> 			if ((j == (n + 1)) && (NowPiant < MinPiant))
> 				MinPiant = NowPiant;
> 		}	
> 		if (MinPiant < 226)
> 			printf("%d\n",MinPiant);
> 		else printf("Inf\n");
> 	}
> 	return 1;
> }

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