break point 在
边数很少,o(n*m)暴力出奇迹~~~#include#include#include#include#include#include#includeusing
namespace std;const int maxn = 1005, maxm = 22222, inf=...
分类:
其他好文 时间:
2014-06-09 23:00:47
阅读次数:
342
题意:容易理解,在威佐夫博奕的基础上新增加了一条要求:就是如果在赢得条件下,输出第一步怎么走。分析:使用暴力判断,详细见代码。代码:#include#include#includeint
a, b;int main(){ double x = (1 + sqrt(5.0))/2.0; i...
分类:
其他好文 时间:
2014-06-09 22:54:44
阅读次数:
231
问题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1495
题目大意:一个瓶子容积s,两个杯子容积分别n,m,并且都没有刻度(不能比对噢!)。相互倒水,求平分的他们的最少倒水次数。
思路:暴力搜索吧。并且求最少,(即最优解),随意上BFS;
思考:状态,转移过程,怎么剪纸。
惨痛的debug,我不解释了。...
分类:
其他好文 时间:
2014-06-08 15:48:26
阅读次数:
234
给出一段数据,然后要更新单个数据,会询问一段数据中的最大值。
又是一道分段树操作。渐渐熟手了。
#pragma once
#include
#include
using namespace std;
class IHateIt_1754_1
{
static const int SIZE = 200001;
int *segTree; //不要使用segTree[SIZE<<2]...
分类:
其他好文 时间:
2014-06-08 15:40:21
阅读次数:
208
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.
You should pack your words in a greedy approach; that i...
分类:
编程语言 时间:
2014-06-08 15:25:00
阅读次数:
282
题目如下:
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
click to show clarification.
Clarification:
What co...
分类:
其他好文 时间:
2014-06-08 14:58:13
阅读次数:
231
Problem Description
Ignatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leave...
分类:
其他好文 时间:
2014-06-08 03:55:37
阅读次数:
273
题目意思:有n个村庄,编号1-n,以矩阵的形式给出任意两个村庄之间的距离,然后告诉已经有q个村庄已经修好了路,问现在要打算使所有村庄都联通需要修路的最小长度。
思路就是构造一棵最小生成树,所以将距离排序,从小到大依次并入,直到集合数为1为止。...
分类:
其他好文 时间:
2014-06-08 03:22:29
阅读次数:
289
Problem Description
lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这个问题。
Input
有多组数据,每组一行,每组就是一篇小文章。每篇小文章都是由小写字母和空格组成,没有标点符号,遇到#时表示输入结束。
Output
...
分类:
其他好文 时间:
2014-06-08 03:08:15
阅读次数:
221
Problem Description
A hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary.
You are to find all the hat’s words in a dictionary.
In...
分类:
其他好文 时间:
2014-06-08 03:02:14
阅读次数:
323