Problem DescriptionZCC has got N strings. He is now playing a game with Miss G.. ZCC will pick up two strings among those N strings randomly(A string ...
分类:
其他好文 时间:
2015-05-22 00:17:18
阅读次数:
169
A.Game With Sticks(451A)水题一道,事实上无论你选取哪一个交叉点,结果都是行数列数都减一,那如今就是谁先减到行、列有一个为0,那么谁就赢了。因为Akshat先选,因此假设行列中最小的一个为奇数,那么Akshat赢,否则Malvika赢。代码:#include #include ...
分类:
其他好文 时间:
2015-05-17 20:06:36
阅读次数:
94
Description
Xuanxuan has n sticks of different length. One day, she puts all her sticks in a line, represented by S1, S2, S3, …Sn. After measuring the length of each stick Sk (1 <= k <= n), she finds...
分类:
其他好文 时间:
2015-05-15 21:31:42
阅读次数:
480
题目链接:
poj2513
题意:
给定一捆木棍。每根木棍的每个端点涂有某种颜色。问:是否能将这些棍子首尾相连,排成
一条直线,且相邻两根棍子的连接处端点的颜色一样。
输入描述:
输入文件中包含若干行,每行为两个单词,用空格隔开,表示一根棍子两个端点的颜色。表
示颜色的单词由小写字母组成,长度不超过10 个字符。木棍的数目不超过250000。
输出描述:
如果木棍...
分类:
其他好文 时间:
2015-05-13 19:49:15
阅读次数:
123
题目传送:Sticks
思路:DFS + 剪枝
AC代码:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define LL long long
#define INF 0x7fff...
分类:
其他好文 时间:
2015-05-06 09:19:38
阅读次数:
143
SticksTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 126238Accepted: 29477DescriptionGeorge took sticks of the same length and cut them rand...
分类:
其他好文 时间:
2015-05-05 08:48:36
阅读次数:
134
// uva 10003 Cutting Sticks 区间dp
// 经典的区间dp
// dp(i,j)表示切割小木棍i-j所需要的最小花费
// 则状态转移为dp(i,j) = min{dp(i,k) + dp(k,j) + a[j]-a[i])
// 其中k>i && k<j
// a[j] - a[i] 为第一刀切割的代价
// a[0] = 0,a[n+1] = L;
// dp数组初...
分类:
其他好文 时间:
2015-05-01 23:55:26
阅读次数:
378
题意:一个机器处理木板,机器重置需要1分钟,如果下一块木板的长度和质量均大于等于前一块的则机器无需重置,否则重置,一开始机器也要花费一分钟,求处理完木板的最短时间。
分析:先按木板的长度排序,若长度相同则按质量排序(从小到大),然后从前往后扫描数组,找出符合的则标记,找完一轮在回头找,直到所有木板被标记则可得最小时间。
#include
#include
using namespace std...
分类:
其他好文 时间:
2015-04-30 12:41:03
阅读次数:
124
参照了http://www.hankcs.com/program/cpp/poj-1065-wooden-sticks.html 代码写得很简洁#include#include#include#include#includeusing namespace std;typedef long long ...
分类:
其他好文 时间:
2015-04-29 19:33:32
阅读次数:
130
解题报告 之 SOJ 2835 Pick Up Points CFW牛吃草喝水模型 最大流
Description
Recently loy are very interested in playing a funny game. There is a board of n*m grid.
Each grid has one point or not. If two adjacency grids both have one point, someone can
pick them up, and...
分类:
其他好文 时间:
2015-04-26 13:56:16
阅读次数:
136