2017年3月17日

BestCoder Round #92 1002 Count the Sheep —— 枚举+技巧

摘要: 题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1002 题解: 做题的时候只是想到用dfs暴搜,结果超时了。(刚学dfs时以为它无所不能,后来渐渐不太喜欢了,因为太暴力了,经常超时) TLE 阅读全文

posted @ 2017-03-17 14:47 h_z_cong 阅读(199) 评论(0) 推荐(0) 编辑

BestCoder Round #92 1001 Skip the Class —— 字典树 or map容器

摘要: 题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1001 题解: 1.trie树 关键是如何将科目与分数进行对应,即如果将字符串与数字对应。由于之前解除了字典树,所以就想到用字典树存储单词,并 阅读全文

posted @ 2017-03-17 14:42 h_z_cong 阅读(253) 评论(0) 推荐(0) 编辑

Codeforces Round #401 (Div. 2) C Alyona and Spreadsheet —— 打表

摘要: 题目链接:http://codeforces.com/contest/777/problem/C C. Alyona and Spreadsheet time limit per test 1 second memory limit per test 256 megabytes input stan 阅读全文

posted @ 2017-03-17 14:31 h_z_cong 阅读(275) 评论(0) 推荐(0) 编辑

Codeforces Round #401 (Div. 2) D Cloud of Hashtags —— 字符串

摘要: 题目链接:http://codeforces.com/contest/777/problem/D 题解: 题意:给出n行字符串,对其进行字典序剪辑。我自己的想法是正向剪辑的,即先对第一第二个字符串进行剪辑,但是这样却不能保证前面的操作是正确的,当后面突然出现一个字典序很小的字符串,那么前面的操作将非 阅读全文

posted @ 2017-03-17 14:25 h_z_cong 阅读(190) 评论(0) 推荐(0) 编辑

Codeforces Round #402 (Div. 2) D String Game —— 二分法

摘要: D. String Game time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output D. String Game time limit 阅读全文

posted @ 2017-03-17 14:15 h_z_cong 阅读(226) 评论(0) 推荐(0) 编辑

2017年3月10日

SCAU 1138 代码等式 并查集

摘要: 1138 代码等式[附加题] 该题有题解 时间限制:500MS 内存限制:65536K 提交次数:59 通过次数:21 题型: 编程题 语言: G++;GCC Description 输入格式 第一行数N为变量个数; 第二行N个数,为每个变量的位数 第三行为一个等式 输入格式 输出格式 输出解的个数 阅读全文

posted @ 2017-03-10 16:18 h_z_cong 阅读(423) 评论(0) 推荐(0) 编辑

2017年3月3日

hdu1198 Farm Irrigation —— dfs or 并查集

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1198 dfs: 1 #include<cstdio>//hdu1198 dfs 2 #include<cstring> 3 4 int well[11][5] = { {1,1,1,0,0},{1,0, 阅读全文

posted @ 2017-03-03 19:59 h_z_cong 阅读(223) 评论(0) 推荐(0) 编辑

hdu1010 Tempter of the Bone —— dfs+奇偶性剪枝

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1010 Tempter of the Bone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other 阅读全文

posted @ 2017-03-03 19:46 h_z_cong 阅读(207) 评论(0) 推荐(0) 编辑

hdu1078 FatMouse and Cheese —— 记忆化搜索

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1078代码1:#include//hdu 1078 记忆化搜索#include#define MAX(a,b) (a>b?a:b)int n,k,dp[105][105],... 阅读全文

posted @ 2017-03-03 19:39 h_z_cong 阅读(178) 评论(0) 推荐(0) 编辑

hdu1052 田忌赛马 —— 贪心

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1052错误代码:#include//田忌赛马,错误版#include#include/*思路:用田忌最快的马与齐王最快的马比较,1.若能赢就赢;2.若赢不了,就用最差的马拖... 阅读全文

posted @ 2017-03-03 19:37 h_z_cong 阅读(443) 评论(0) 推荐(0) 编辑

hdu1015 Safecracker —— 回溯

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1015代码1:#include//hdu1015#include#include#includedouble tg;int len;char a[20],b[20];//a... 阅读全文

posted @ 2017-03-03 19:29 h_z_cong 阅读(967) 评论(0) 推荐(0) 编辑

poj3461 Oulipo —— KMP

摘要: 题目链接:http://poj.org/problem?id=3461 代码如下: 阅读全文

posted @ 2017-03-03 19:08 h_z_cong 阅读(146) 评论(0) 推荐(0) 编辑

2017年2月23日

poj2513 Colored Sticks —— 字典树 + 并查集 + 欧拉回路

摘要: 题目链接:http://poj.org/problem?id=2513 题解:通过这题了解了字典树。用字典树存储颜色,并给颜色编上序号。这题为典型的欧拉回路问题:将每种颜色当成一个点。首先通过并查集判断是否为连通图,再检验是否符合欧拉回路的特点。不过题目有一点很奇怪,在并查集中,若图为连通,不是有且 阅读全文

posted @ 2017-02-23 21:25 h_z_cong 阅读(226) 评论(0) 推荐(0) 编辑

2017年2月19日

poj3349 Snowflake Snow Snowflakes —— 哈希表

摘要: 题目链接:http://poj.org/problem?id=3349题意:雪花有6个瓣,有n个雪花,输入每个雪花的瓣长,判断是否有一模一样的雪花(通过旋转或翻转最终一样,即瓣长对应相等)。如果前面的雪花判断出有重复,则不需对后续的进行操作。题解:直接将花瓣存在二维数... 阅读全文

posted @ 2017-02-19 20:32 h_z_cong 阅读(184) 评论(0) 推荐(0) 编辑

2017年2月13日

poj3295 Tautology —— 构造法

摘要: 题目链接:http://poj.org/problem?id=3295题意:输入由p、q、r、s、t、K、A、N、C、E共10个字母组成的逻辑表达式,其中p、q、r、s、t的值为1(true)或0(false),即逻辑变量;K、A、N、C、E为逻辑运算符,K --> ... 阅读全文

posted @ 2017-02-13 15:04 h_z_cong 阅读(292) 评论(0) 推荐(0) 编辑

导航