【HDU】2147 kiki's game
http://acm.hdu.edu.cn/showproblem.php?pid=2147题意:n×m的棋盘,每次可以向左走、向下走、向左下走,初始在(1, m),n,m<=2000,问先手是否胜利。#include <cstdio>using namespace std;int...
HDU 5558 后缀数组+二分
题意有一些绕,但其实就是对于不断变化的i,求以j(0=j<i)使得suffix[j]与suffix[i]的最长公共前缀最长,如果有多个j,则取最小的j。可以在rank数组中二分,在1-rank[i-1]中二分最接近i的j使得sa[j]小于i,通俗地说就是rank比的rank[i]小,并且位于i...
HDU3376 最小费用最大流 模板2
Matrix AgainTime Limit: 5000/2000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)Total Submission(s): 4255 Accepted Submission(s): ...
HDU 2144 (最长连续公共子列 + 并查集) Evolution
我发现我一直理解错题意了,这里的子序列指的是连续子序列,怪不得我写的LCS一直WA顺便复习一下并查集 //#define LOCAL #include <iostream> #include <cstdio> #include <cstring> #include...
hdu 5438 Ponds dfs
Time Limit: 1500/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Problem DescriptionBetty owns a lot of ponds, some of them are co...
HDU 2162 Add ‘em
http://acm.hdu.edu.cn/showproblem.php?pid=2162Problem DescriptionWrite a program to determine the summation of several sets of integers.InputThe input...
hdu 5335 Walk Out(bfs+寻找路径)
Problem DescriptionIn an n∗m maze, the right-bottom corner is the exit (position (n,m) is the exit). In every position of this maze, there is either a...
HDOJ(HDU) 1898 Sempr == The Best Problem Solver?(水题、、、)
Problem Description As is known to all, Sempr(Liangjing Wang) had solved more than 1400 problems on POJ, but nobody know the days and nights he had sp...
HDU 5547 Sudoku(DFS)
题目网址:http://acm.hdu.edu.cn/showproblem.php?pid=5547题目:SudokuTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total S...
HDU 4828 (卡特兰数+逆)
HDU 4828 Grids思路:能够转化为卡特兰数,先把前n个人标为0。后n个人标为1。然后去全排列,全排列的数列。假设每一个1的前面相应的0大于等于1,那么就是满足的序列,假设把0看成入栈,1看成出栈。那么就等价于n个元素入栈出栈,求符合条件的出栈序列,这个就是卡特兰数了。然后去递推一下解,过程...
HDU 5762 Teacher Bo (暴力)
Teacher Bo题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5762DescriptionTeacher BoBo is a geography teacher in the school.One day in his class,he mark...
hdu 4850 Wow! Such String!(字符串处理,yy)
题目参考了博客http://blog.csdn.net/u013368721/article/details/37575165//用visit[26][26][26][26]来判断新家新区的子母河前三个组合而成的4个字符的串是否和之前的重复。//再加上最初三个字符,所以,总共有26*26*26*26...
hdu 5739 割点
FantasiaTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1654 Accepted Submission(s): 429Pr...
HDU 1525 Euclid's Game
题目大意:题目给出了两个正数a.b每次操作,大的数减掉小的数的整数倍。一个数变为0 的时候结束。谁先先把其中一个数减为0的获胜。问谁可以赢。Stan是先手。题目思路:无论a,b的值为多少,局面:[a%b,b] 一定会出现。双方都足够聪明,无论谁都知道这种局面是必胜局面还是必败局面若是必败局面操作者为...
2010多校第一题 hdu3440House Man 差分约束系统
给我们n座房子,房子的高度各不相同, 从最低的房子开始, 每次跳到更高的房子, 跳n-1次最能跳到最高的房子了,但是每次跳跃的距离不能超过d将这些房子在一维的方向上重新摆放(但是保持输入时的相对位置不变) , 使得最矮的房子和最高的房子水平距离最大将房子的坐标设为xi, n个变量, 和2(n-1)...
HDU 6083 度度熊的午饭时光(01背包+记录路径)
http://acm.hdu.edu.cn/showproblem.php?pid=6083题意:思路:01背包+路径记录。题目有点坑,我一开始逆序枚举菜品,然后一直WA,可能这样的话路径记录会有点问题。 #include<iostream> #include<algorithm&...
hdu4578 Transformation
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4578题目大意:n个数(初始为0)m个操作,操作类型有4种,操作1把区间的每个数+a,操作2把区间的每个数*a.,操作3把区间的每个数=a,操作4,查询区间每个数p次方的和(1<=p<=3)解...
hdu A strange lift
有起点和终点,有方向,有最少次数,所以这道题很明显是一道bfs的题目,这题要利用vist数组来标记已走过的楼层,因为这题里面已走过的楼层是不可能在走第二遍的。第二次走和第一次走的选择没有任何的区别。#include"iostream"#include"stdio.h"#include"string....
HDU-4618 Palindrome Sub-Array 暴力枚举
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4618直接暴力枚举中心点,在中间如果求不出最大值直接跳过优化下。。。 //STATUS:C++_AC_31MS_800KB #include <functional> #include <...
hdu 2014 青年歌手大奖赛_评委会打分
题意:输入N个数,去掉最大和最小的数,求剩余的数的平均数。解法:找到分别最大和最小的数,然后从总和中减去他们,再求平均数(不要排序); 1: #include<stdlib.h> 2: #include<stdio.h> 3: #include<str...