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:bfs?

Posted by gemenhao at 2006-08-15 09:00:26 on Problem 2969
In Reply To:bfs? Posted by:bluewind at 2006-08-14 22:01:06
贪心就可,最后一位为0或5(没有0,5就无解),(有0就是0)求出各数字和除3余数,然后从其余数字中去除一个或两个数,保证和能被3整除即可
025 ----〉0  去除两个
115 ----〉15 去除1个
记录个数字个数
/*
	char s[1011];
	int dig[10] = {0}, sum = 0;
	scanf("%s",s);
	for (int i = 0; s[i]; i++){
		dig[s[i] - '0']++;
		sum += s[i] - '0';
	}
	if (dig[0] + dig[5] == 0){
		printf("impossible\n");
		return 0;
	}
*/

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