- 博客(77)
- 收藏
- 关注
原创 HDU 4193单调队列
题意:给你一个n项的序列,每次可以把序列的首项移动到末尾,显然一共可以构成n种序列,问一共有多少种序列满足条件:序列的前i项和都大于等于0(i:1~n)。解题思路:开一个2*n的数组,后面n项复制前面n项。这样,每个长度为n的区间都代表一种序列。(这也是循环序列的一般做法吧),然后,数组中的值sum[i]记录前面i项的和(1~i)。这样,我们在考虑以k为起点的区间时
2013-10-31 22:21:46 734
原创 POJ2823Sliding Window--单调队列
关键字队列,合并果子,窗户,广告印刷,最长XX子序列,志愿者选拔,动态规划,烽火传递正文单调队列,望文生义,就是指队列中的元素是单调的。如:{a1,a2,a3,a4……an}满足a1序列便是单调递增序列。同理递减队列也是存在的。单调队列的出现可以简化问题,队首元素便是最大(小)值,这样,选取最大(小)值的复杂度便为o(1),由于队列的性质,每个元素入队一次,出队一次,维护队列的复杂
2013-10-31 19:54:25 823
原创 HDU1116(Play On Words)可做欧拉回路模板
水题吧。。搞清楚欧拉回路的判断方法这题的难度就为0了。并查集判联通还有结点出入度关系搞清楚就好了。 Play on Words Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 6
2013-10-30 21:16:36 645
原创 ACM学习计划分类
初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. (5)构造法.(poj3295) (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法:
2013-10-30 21:13:53 901
原创 数据结构上机题目--dijkstra
dijkstra:/************************************************************************** author:crazy_石头* algorithm:Dijkstra* date:2013/09/29* 程序功能:最短路* 算法流程:初始时,S中仅含有源。设u是G的某一个顶点,把从源到u且中间只经过S中顶点的路
2013-10-28 16:40:11 709
原创 数据结构上机题目--MST
prim算法/************************************************************************** author:crazy_石头* algorithm:prim* date:2013/09/29* 程序功能:MST* 算法流程:1.先选取一个点作起始点,然后选择它邻近的权值最小的点(如果有多个与其相连的相同最小权值的
2013-10-28 16:38:24 805
原创 数据结构上机题目--搜索
BFS邻接表。/************************************************************************** author:crazy_石头* algorithm:bfs* date:2013/09/29* 程序功能:bfs一个图**************************************************
2013-10-28 16:36:19 699
原创 数据结构上机题目--离散时间模拟(银行等待问题)
/************************************************************************** author:crazy_石头* algorithm:纯纯的模拟* date:2013/09/29* 程序功能:模拟银行等待时间....orz************************************************
2013-10-28 16:32:24 866 2
原创 数据结构上机题目4--后缀表达式求值
/************************************************************************** author:crazy_石头* algorithm:..* date:2013/09/29* 程序功能:计算后缀表达式***********************************************************
2013-10-28 16:24:01 821
原创 数据结构上机题目3--学生信息排序
/************************************************************************** author:crazy_石头* algorithm:bubble_sort* date:2013/10/20* 程序功能:对学生信息进行排序************************************************
2013-10-28 16:22:42 770
原创 数据结构上机题目2--快排
#include #include #include #include using namespace std;void QuickSort(int l,int r,int b[]){ int i,j,x; if(l>=r)return ; i=l; j=r; x=b[i]; while(i!=j) { whi
2013-10-28 16:20:09 661
原创 数据结构上机题目1--基本排序
/************************************************************************** author:crazy_石头* algorithm:bubble_sort* date:2013/09/29* 程序功能:随机产生1000个整数存入bubble_sort.txt,然后从文件中读到数组里面进行冒泡排序。*********
2013-10-28 16:19:04 778
原创 10098 全排列水题
/***************************************** author:crazy_石头* algorithm:dfs* date:2013/10/17* pro:UVA 10098*****************************************/#pragma comment(linker, "/STACK:1024000000,1024
2013-10-17 20:37:36 782
原创 交叉染色法判定二分图
Divide GroupsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 916 Accepted Submission(s): 322Problem Description This year
2013-10-17 19:50:35 1064
原创 10004--Bicoloring
交叉染色法。。。。 BicoloringIn 1976 the ``Four Color Map Theorem" was proven with the assistance of a computer. This theorem states that every map can be colored using only four colors,
2013-10-16 19:56:24 662
原创 10000-Longest Paths
Longest PathsIt is a well known fact that some people do not have their social abilities completely enabled. One example is the lack of talent for calculating distances and intervals of tim
2013-10-16 18:49:35 971
原创 10341 - Solve It
Problem FSolve ItInput: standard inputOutput: standard outputTime Limit: 1 secondMemory Limit: 32 MBSolve the equation: p*e-x+ q*sin(x) + r*cos(x) + s*tan(x) +t*x2 + u = 0
2013-10-09 19:13:54 706
原创 11210 - Chinese Mahjong
Problem CChinese MahjongMahjong () is a game of Chinese origin usually played by four persons with tiles resembling dominoes and bearing various designs, which are drawn and discarded until one
2013-10-09 19:05:10 903
原创 isap测模板--HDU3549
Flow ProblemTime Limit: 5000/5000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 5990 Accepted Submission(s): 2790Problem DescriptionNetwork flow is a
2013-10-09 13:07:46 954
转载 字符串 之 KMP算法
KMP算法是一种改进的字符串匹配算法,由D.E.Knuth与V.R.Pratt和J.H.Morris同时发现,因此人们称它为克努特——莫里斯——普拉特操作(简称KMP算法)。在介绍KMP算法之前,先介绍一下BF算法。一.BF算法 BF算法是普通的模式匹配算法,BF算法的思想就是将目标串S的第一个字符与模式串P的第一个字符进行匹配,若相等,则继续比较S的第二个字符和
2013-10-09 13:05:09 749
原创 HDU1035Robot Motion(模拟&&深搜)
Robot MotionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5358 Accepted Submission(s): 2495Problem DescriptionA robot has b
2013-10-09 13:00:07 683
原创 Problem 1056 - 函数问题 ---三分法
Problem 1056 - 函数问题Time Limit: 1000MS Memory Limit: 65536KB Difficulty: Total Submit: 264 Accepted: 44 Special Judge: No Description我们定义函数Y=Ax^2+Bx+C; (0
2013-10-09 12:57:32 748
原创 HDU1969---Pie 二分
PieTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3019 Accepted Submission(s): 1176Problem DescriptionMy birthday is coming up a
2013-10-09 12:55:38 631
原创 XDUProblem 1078 - 地震和海啸
http://acm.xidian.edu.cn/land/problem/detail?problem_id=1078Problem 1078 - 地震和海啸 Time Limit: 1000MS Memory Limit: 65536KB Difficulty: Total Submit: 165 Accepted: 66 Spec
2013-10-09 12:52:41 739
原创 Usaco 2.4 Cow Tours(Floyd)
Cow ToursFarmer John has a number of pastures on his farm. Cow paths connect some pastures with certain other pastures, forming a field. But, at the present time, you can find at least two pasture
2013-10-09 00:19:06 969
原创 XDU Problem 1258 - 黑白棋 (二分图匹配 )
Problem 1258 - 黑白棋Time Limit: 1000MS Memory Limit: 65536KB Difficulty: Total Submit: 26 Accepted: 6 Special Judge: No Description定义一种新的黑白棋1、棋盘大小为5*5的格子2、有些格子不能放棋子
2013-10-09 00:13:50 969
原创 九度OJ(1091)棋盘游戏
题目1091:棋盘游戏 时间限制:1 秒内存限制:32 兆特殊判题:否提交:622解决:155题目描述: 有一个6*6的棋盘,每个棋盘上都有一个数值,现在又一个起始位置和终止位置,请找出一个从起始位置到终止位置代价最小的路径:1、只能沿上下左右四个方向移动2、总代价是没走一步的代价之和3、每步(从a,b到c,d)的代价
2013-10-09 00:01:33 1538
原创 HDU1078(深搜+DP)
FatMouse and CheeseTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3515 Accepted Submission(s): 1390Problem DescriptionFatMouse h
2013-10-08 23:56:58 761
原创 HDU1102Constructing Roads(MST)
Constructing RoadsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10568 Accepted Submission(s): 3932Problem DescriptionThere are
2013-10-08 23:55:35 615
原创 HDU1203(I need an offer)01背包
I NEED A OFFER! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
2013-10-08 23:52:58 776
原创 POJ3070矩阵快速幂求Fib
欲哭无泪。。。。。比赛的时候都敲不出来。。 FibonacciTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7770 Accepted: 5518DescriptionIn the Fibonacci integer sequence, F0
2013-10-08 23:50:45 1355
原创 HDU1575矩阵快速幂裸题
Tr A Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s):
2013-10-08 23:49:40 870
原创 2013 ACM/ICPC Asia Regional Online —— Warmup HDU4707
PetTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 586 Accepted Submission(s): 295Problem DescriptionOne day, Lin Ji wake up in t
2013-10-08 23:47:19 842
原创 XDU1271National Disaster(求桥模板题)
Problem 1271 - National DisasterTime Limit: 1000MS Memory Limit: 65536KB Difficulty: Total Submit: 64 Accepted: 11 Special Judge: No Description There are N cities i
2013-10-08 23:44:12 753
原创 Usaco 3.1Agri-Net(MST)
————————————————————————————————————————————————————————————PS:这大水题就不说了吧,胡搞,随便写都能过的,LRJ老师书上的模板。。。。。 我写的Kruscal。。。。Agri-NetRuss Cox Farmer John has been elected mayor of his town! One of hi
2013-10-08 23:39:13 733
原创 陕西省第一届ACM程序设计竞赛D题(最大生成树)
Problem 1268 - Donald’s companyTime Limit: 1000MS Memory Limit: 65536KB Difficulty: Total Submit: 3 Accepted: 3 Special Judge: No DescriptionDonald established a c
2013-10-08 23:36:55 1225
原创 ZOJ1872Freckles(MST)
ZOJ Problem Set - 1872FrecklesTime Limit: 2 Seconds Memory Limit: 65536 KB In an episode of the Dick Van Dyke show, little Richie connects the freckles on his Dad's back to form a p
2013-10-08 23:33:18 688
原创 陕西省第一届ACM程序设计竞赛A题(快速幂)
http://acm.xidian.edu.cn/land/problem/detail?problem_id=1265Problem 1265 - A^B % P Time Limit: 1000MS Memory Limit: 65536KB Difficulty: Total Submit: 6 Accepted: 4 Speci
2013-10-08 23:26:13 1452
原创 Usaco 2.3 Zero Sums(回溯DFS)--暴搜
Zero SumConsider the sequence of digits from 1 through N (where N=9) in increasing order:1 2 3 ... N. Now insert either a `+' for addition or a `-' for subtraction or a ` ' [blank] to run the
2013-10-08 23:22:19 765
原创 Trie树入门题目--HDU1671 Phone List
Phone ListTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7265 Accepted Submission(s): 2501Problem DescriptionGiven a list of phone
2013-10-08 23:18:38 765
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人