摘要:        
安慰奶牛DescriptionFarmer John变得非常懒, 他不想再继续维护供奶牛之间供通行的道路. 道路被用来连接N(5 #include#include#include#include#include#include#include#include#include#include#define MAX 100001#define INF (1> n >> m; int mi = INF; for (i = 1; i > c[i]; mi = min(mi, c[i]); par[i] = i; } for (i = 1; i > x...    阅读全文
posted @ 2014-02-12 21:02
偶尔会寂寞
阅读(163)
评论(0)
推荐(0)
        
            
        
        
摘要:        
问题描述给定一个n个顶点,m条边的有向图(其中某些边权可能为负,但保证没有负环)。请你计算从1号点到其他点的最短路(顶点从1到n编号)。输入格式第一行两个整数n, m。接下来的m行,每行有三个整数u, v, l,表示u到v有一条长度为l的边。输出格式共n-1行,第i行表示1号点到i+1号点的最短路。样例输入3 31 2 -12 3 -13 1 2样例输出-1-2数据规模与约定对于10%的数据,n = 2,m = 2。对于30%的数据,n #define MAX 20001using namespace std;struct edge{ int from, to, cost; };edge es    阅读全文
posted @ 2014-02-12 16:16
偶尔会寂寞
阅读(176)
评论(0)
推荐(0)
        
            
        
        
摘要:        
http://acm.hdu.edu.cn/showproblem.php?pid=1518算法参考:http://blog.csdn.net/w00w12l/article/details/7865348Problem DescriptionGiven a set of sticks of various lengths, is it possible to join them end-to-end to form a square?InputThe first line of input contains N, the number of test cases. Each test cas    阅读全文
posted @ 2014-02-12 15:27
偶尔会寂寞
阅读(105)
评论(0)
推荐(0)
        
 
                    
                     
                    
                 
                    
                
 
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号