01 2017 档案
摘要:最简单的记忆化搜索,题目有点问题,a, b, c中若既满足其中一个不大于0,又满足其中一个大于20,按前一种情况。 Code: 1 #include<bits/stdc++.h> 2 using namespace std; 3 int w[21][21][21]; 4 5 int dfs(int
阅读全文
摘要:经典的字典树,debug爽歪歪。 Code: 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int MAXN = 500000; 4 int ch[MAXN][26], tag[MAXN], tot = 1; 5 char word
阅读全文
摘要:简单并查集 Code 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int MAXN = 10000 + 10; 4 const int dx[] = {1, -1, 0, 0, 1, -1, 1, -1}; 5 const int
阅读全文
摘要:1 #include<bits/stdc++.h> 2 using namespace std; 3 #define MAXN 1000+10 4 int dp[MAXN][MAXN], a[MAXN]; 5 6 void InitRMQ(int l, int r, int n){ 7 int k
阅读全文
摘要:Description FJ has purchased N (1 <= N <= 2000) yummy treats for the cows who get money for giving vast amounts of milk. FJ sells one treat per day an
阅读全文
摘要:Problem Description Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and kno
阅读全文
摘要:思路: 如果只判断子串是否有13的话非常简单,这题还加了一个条件就是要被13整除; 这里就要用到模运算的性质,即(a+b+c)%d = (a%d + b%d + c%d)%d。 Code: 1 #include<bits/stdc++.h> 2 #define M(a, b) memset(a, b
阅读全文
摘要: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 hi
阅读全文
摘要:题目: Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计
阅读全文
摘要:1 #include<bits/stdc++.h> 2 using namespace std; 3 4 typedef struct TrieNode{ 5 bool flag; 6 TrieNode *next[26]; 7 TrieNode(){ 8 flag = false; 9 memse
阅读全文
摘要:题目: Given a sequence a[1],a[2],a[3]……a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in th
阅读全文
摘要:题目: Marsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles
阅读全文
摘要:题目: 大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101)
阅读全文
摘要:题目: 一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input 输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多
阅读全文
摘要:模板1: 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 void InitNext(char *s, int *next){ 5 int i = 0, j = -1, len = strlen(s); 6 next[0] = -1; 7 w
阅读全文
摘要:题目: The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms
阅读全文
摘要:题目: 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度
阅读全文
摘要:题目: 通过悬崖的yifenfei,又面临着幽谷的考验—— 幽谷周围瘴气弥漫,静的可怕,隐约可见地上堆满了骷髅。由于此处长年不见天日,导致空气中布满了毒素,一旦吸入体内,便会全身溃烂而死。 幸好yifenfei早有防备,提前备好了解药材料(各种浓度的万能药水)。现在只需按照配置成不同比例的浓度。 现
阅读全文
摘要:题目: 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input 测试输入包含若干测试用例。每个测试用例的第1行给出
阅读全文
摘要:题目: Whuacmers use coins.They have coins of value A1,A2,A3…An Silverland dollar. One day Hibix opened purse and found there were some coins. He decided
阅读全文
摘要:题目: The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they beco
阅读全文
摘要:讲道理这题真是背包问题中的水题,第一次写背包如此轻松。 题目: 不死族的巫妖王发工资拉,死亡骑士拿到一张N元的钞票(记住,只有一张钞票),为了防止自己在战斗中频繁的死掉,他决定给自己买一些道具,于是他来到了地精商店前. 死亡骑士:”我要买道具!” 地精商人:”我们这里有三种道具,血瓶150块一个,魔
阅读全文