随笔分类 - HDU_ACM
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4607 题解:给定一棵树,从树中的任意选一个顶点出发,遍历K个点的最短距离是多少?(每条边的长度为1) 算法分析: 首先如果k小于等于直径长度,那么答案为k−1;如果k大于直径长度,设直径长度为r,那么答
阅读全文
摘要:All X Accepts: 1281 Submissions: 7580 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) All X Accepts: 1281 Submissions
阅读全文
摘要:Description Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i,
阅读全文
摘要:Problem A Accepts: 1829 Submissions: 12436 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem A Accepts: 1829 Su
阅读全文
摘要:Problem Description Homer: Marge, I just figured out a way to discover some of the talents we weren’t aware we had.Marge: Yeah, what is it?Homer: Take
阅读全文
摘要:Problem Description 人随着岁数的增长是越大越聪明还是越大越笨,这是一个值得全世界科学家思考的问题,同样的问题Eddy也一直在思考,因为他在很小的时候就知道亲和串如何判断了,但是发现,现在长大了却不知道怎么去判断亲和串了,于是他只好又再一次来请教聪明且乐于助人的你来解决这个问题。亲
阅读全文
摘要:Problem Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Ouli
阅读全文
摘要:Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Yo
阅读全文
摘要:学习链接: http://www.cppblog.com/mythit/archive/2009/04/21/80633.html http://blog.csdn.net/niushuai666/article/details/7002736 http://www.cnblogs.com/kuan
阅读全文
摘要:Problem Description Claris loves bitwise operations very much, especially XOR, because it has many beautiful features. He gets four positive integers
阅读全文
摘要:描述Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. F
阅读全文
摘要:旋转卡壳:http://www.cnblogs.com/Booble/archive/2011/04/03/2004865.html 代码:
阅读全文
摘要:看来自己floyd还是没有深刻的理解....用Floyd存路径很是不错...get....
阅读全文
摘要:某地到某地 需要用到map来存储字符串(把地点用数字来标记)......之后就是Dijkstra.... 如果超时就用 long long定义mp.....数组不要开太大....不然会Memory Limit Exceed..... 代码:
阅读全文
摘要:多个起点,多个终点,找到最短的起点,终点....枚举遍历即可..... 自己手残,找了好久的bug 变量写串了....orz AC代码:
阅读全文
摘要:最小生成树....先建图,之后再处理相同地点....只需要遍历一半就行.... 时间超限: AC代码:
阅读全文
摘要:9A 2 B 12 I 25B 3 C 10 H 40 I 8C 2 D 18 G 55D 1 E 44E 2 F 60 G 38F 0G 1 H 35H 1 I 353A 2 B 10 C 40B 1 C 200 Prim算法 促进理解了最小生成树的构建 找边 代码:
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2612 BFS搜索 目标地 并记录下来 之后再判断两段路程之和 代码: 1 #include <stdio.h> 2 #include <string.h> 3 #include <math.h> 4 #
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1242 简单优先队列搜索,自己好久不敲,,,,,手残啊,,,,orz 代码: 1 #include <stdio.h> 2 #include <string.h> 3 #include <math.h>
阅读全文