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:冯威论文里n<>4为什么啊?

Posted by hdu07005 at 2007-07-18 18:44:34 on Problem 1275
In Reply To:冯威论文里n<>4为什么啊? Posted by:huangwei at 2007-07-18 18:08:08
> rt。
> bool bellman_ford()
> {
> 	int i,j,k;
> 	bool flag ;
> 	
> 	memset(s,0,sizeof(s));
> 	for (i=2;i<=24;i++) {
> 		flag = true;
> 		for (j=0;j<=24;j++) {
> 			for (k=map[j].size()-1;k>=0;k--) {
> 				node edge = map[j][k];
> 				if (s[j]+edge.v > s[edge.e]) {// >=最长路, <=最短路
> 					s[edge.e] = s[j] + edge.v;
> 					flag = false;
> 				}
> 			}
> 		}
> 		if (flag) {
> 			break ;
> 		}
> 	}
> 	for (i=1;i<24;i++) {
> 		if (s[i-1] - s[i] < -num[i]) {// 不满足条件
> 			return false;
> 		}
> 	}
> 	for (j=0;j<24;j++) {
> 		for (k=map[j].size()-1;k>=0;k--) {
> 			node edge = map[j][k];
> 			if (s[j]+edge.v > s[edge.e]) {// 有正权回路
> 				return false;
> 			}
> 		}
> 	}
> 	return n != 4;// ????????
> }
> 改成return true;就WA的,奇怪,什么意思啊??

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