HDU 1301 Jungle Roads

摘要: The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so the large road network is too expensive to maintain. The Council of Elders must choose to stop main 阅读全文
posted @ 2012-04-03 22:20 江财小子 阅读(153) 评论(0) 推荐(0) 编辑

HDU 1233 还是畅通工程

摘要: 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( < 100 );随后的N(N-1)/2行对应村庄间的距离,每行给出一对正整数,分别是两个村庄的编号,以及此两村庄间的距离。为简单起见,村庄从1到N编号。当N为0时,输入结束,该用例不被处理。Output对每个测试用例,在1行里输出最小的公路总长度。Sample Input3 1 阅读全文
posted @ 2012-04-02 21:47 江财小子 阅读(204) 评论(0) 推荐(0) 编辑

HDU 1709 The Balance

摘要: Now you are asked to measure a dose of medicine with a balance and a number of weights. Certainly it is not always achievable. So you should find out the qualities which cannot be measured from the range [1,S]. S is the total quality of all the weights.InputThe input consists of multiple test cases, 阅读全文
posted @ 2012-04-02 16:55 江财小子 阅读(300) 评论(0) 推荐(0) 编辑

HDU 1171 Big Event in HDU

摘要: Nowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know that Computer College had ever been split into Computer College and Software College in 2002.The splitting is absolutely a big event in HDU! At the same time, it is a trouble thing too. All fa 阅读全文
posted @ 2012-04-02 14:42 江财小子 阅读(145) 评论(0) 推荐(0) 编辑

Hdu 1398 Square Coins

摘要: People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ..., and 289-credit coins, are available in Silverland. There are four co 阅读全文
posted @ 2012-04-02 13:17 江财小子 阅读(171) 评论(0) 推荐(0) 编辑

HDU 1085 Holding Bin-Laden Captive!

摘要: We all know that Bin-Laden is a notorious terrorist, and he has disappeared for a long time. But recently, it is reported that he hides in Hang Zhou of China! “Oh, God! How terrible! ”Don’t be so afraid, guys. Although he hides in a cave of Hang Zhou, he dares not to go out. Laden is so bored recent 阅读全文
posted @ 2012-04-02 13:06 江财小子 阅读(122) 评论(0) 推荐(0) 编辑

HDU 1028 Ignatius and the Princess III

摘要: "Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says."The second problem is, given an positive integer N, we define an equation like this:N=a[1]+a[2]+a[3]+...+a[m];a[i]>0,1#include using namespace std;int a[123],b[123];int mai 阅读全文
posted @ 2012-04-02 12:31 江财小子 阅读(166) 评论(0) 推荐(0) 编辑

hdu 1106 排序

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1106比较简单,不过还是出错了、输入一行数字,如果我们把这行数字中的‘5’都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以‘0’开头,这些头部的‘0’应该被忽略掉,除非这个整数就是由若干个‘0’组成的,这时这个整数就是0)。你的任务是:对这些分割得到的整数,依从小到大的顺序排序输出。#include <stdio.h>#include <string.h>#include <stdlib.h>int cmp(const void *a,const void 阅读全文
posted @ 2012-03-31 21:06 江财小子 阅读(125) 评论(0) 推荐(0) 编辑

并查集-Is It A Tree?hdu 1325

摘要: 题目连接http://acm.hdu.edu.cn/showproblem.php?pid=1325http://poj.org/problem?id=1308在POJ上WA了,看来还是有问题的呀#include <iostream>#include <cstdio>#include <string.h>using namespace std;int hr[100003],hs[100003];int mer[100003];int main(){ // freopen("in.txt","r",stdin); int 阅读全文
posted @ 2012-03-31 17:26 江财小子 阅读(344) 评论(0) 推荐(0) 编辑

POJ 1423 Big Number

摘要: 题目连接:http://poj.org/problem?id=1423#include #include #include #include #include #include #include using namespace std;int a[10000001];int main(){ //freopen("in.txt","r",stdin); int n,i,t,m; double sum; for(i=1;i<=10000000;i++)//打表,开始忘记了,果断TLT,得长记性! { sum+=log10(double(i)); a[i 阅读全文
posted @ 2012-03-30 09:35 江财小子 阅读(116) 评论(0) 推荐(0) 编辑