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

Re:没想到还有这个复杂度....长见识了...

Posted by GetAC at 2008-08-19 01:48:45 on Problem 2965
In Reply To:O(48)的代码,竟然很艰难才刷到0ms,大家来看看 Posted by:lynncui at 2008-08-19 01:40:43
> #include <stdio.h>
> int change[5][5] = {{0,0,0,0,0},
> {0,63624,62532,61986,61713},
> {0,36744,20292,12066,7953},
> {0,35064,17652,8946,4593},
> {0,34959,17487,8751,4383}};
> struct point { int i, j;}p[17];
> void main()
> {
> 	//freopen("test.txt","r",stdin);
> 	int i, j, ans, d=0, good;
> 	char c;
> 	good = 0;
> 	for(i=1; i<=4; i++)
> 	{
> 		
> 		for(j=1; j<=4; j++)
> 		{
> 			scanf("%c", &c);
> 			if(c == '+')good ^= change[i][j];
> 		}
> 		getchar();
> 	}
> 	
> 	ans = 0;
> 	i = 4, j = 4;good *= 2;
> 	while(good >>= 1)//除以2
> 	{
> 		if((good & 1) == 1)//模2
> 		{
> 			ans ++;
> 			p[d].i = i;
> 			p[d++].j = j;
> 		}
> 		if(j == 1)j = 4, i--;
> 		else j--;
> 	}
> 
> 	printf("%d\n", ans);
> 	for(i=0; i<d; i++)printf("%d %d\n", p[i].i, p[i].j);
> }
> 
> /*Power By GDUT_CHC*/

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