算法
sibangde
这个作者很懒,什么都没留下…
展开
-
poj2491Scavenger Hunt
Scavenger HuntTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2621 Accepted: 1432DescriptionBackground Bill has been the greatest boy scout in America a原创 2014-07-12 11:11:34 · 641 阅读 · 0 评论 -
hdu1002A + B Problem II
A + B Problem IITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 206363 Accepted Submission(s): 39670Problem DescriptionI have a v原创 2014-07-12 13:51:18 · 564 阅读 · 0 评论 -
全排列问题的STL用法(next_permutation类)
全排列问题的STL用法(next_permutation类)标准库全排列next_permutation() 在标准库算法中,next_permutation应用在数列操作上比较广泛.这个函数可以计算一组数据的全排列.但是怎么用,原理如何,我做了简单的剖析.首先查看stl中相关信息.函数原型:template bool next_permu转载 2014-07-11 22:14:07 · 454 阅读 · 0 评论 -
poj1007DNA Sorting
DNA SortingTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 81639 Accepted: 32837DescriptionOne measure of ``unsortedness'' in a sequence is the number of原创 2014-07-12 12:01:53 · 438 阅读 · 0 评论 -
学习笔记
sort函数是C++中的排序函数其头文件为:#include头文件; qsort()是C中的排序函数,其头文件为:#include原创 2014-07-12 12:52:37 · 382 阅读 · 0 评论 -
字符串问题
给定一个字符串,对字符串进行如下处理:“将所有的两个连续的相同的字符,删除掉”输出为最终的替换结果daabc -> dbcdaadc -> c原创 2014-07-13 15:30:03 · 418 阅读 · 0 评论 -
简单的快排函数
#include"stdio.h"#include"iostream"using namespace std;int division(int a[],int left,int right){ int base=a[left]; while(left<right) { while(left=base) --right; a[left]=a[right原创 2014-07-12 10:02:46 · 364 阅读 · 0 评论 -
快排细则
快速排序库函数qsort调用细则 关于快排,其原理及实现网上可以找到很多,我给出的那些动画视频链接里面也有形象的演示,可以上网搜到很多,这里主要讲的是怎样调用系统提供的快排库函数:qsort,它包含在头文件里,函数一共四个参数,在函数头部加上#include,转载 2014-07-11 20:31:02 · 469 阅读 · 0 评论 -
hdu1800Flying to the Mars
Flying to the MarsTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10381 Accepted Submission(s): 3349Problem DescriptionIn the原创 2014-07-12 10:59:12 · 362 阅读 · 0 评论 -
poj2503Babelfish
BabelfishTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 31167 Accepted: 13438DescriptionYou have just moved from Waterloo to a big city. The people here原创 2014-07-12 11:05:30 · 359 阅读 · 0 评论 -
hdu1106排序
排序Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 33638 Accepted Submission(s): 9416Problem Description输入一行数字,如果我们把这行数字中的‘5’都看成空格原创 2014-07-12 11:40:26 · 524 阅读 · 0 评论 -
hdu1157Who's in the Middle
Who's in the MiddleTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9026 Accepted Submission(s): 4339Problem DescriptionFJ is surv原创 2014-07-12 11:52:11 · 416 阅读 · 0 评论 -
poj3664Election Time
Election TimeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7224 Accepted: 3920DescriptionThe cows are having their first election after overthrowing原创 2014-07-12 12:46:27 · 436 阅读 · 0 评论 -
hdu1173 采矿
采矿Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2589 Accepted Submission(s): 1195Special JudgeProblem Description某天gameboy玩魔兽R原创 2014-07-12 11:37:43 · 700 阅读 · 0 评论 -
hdu1004Let the Balloon Rise
Let the Balloon RiseTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 71810 Accepted Submission(s): 26743Problem DescriptionContest原创 2014-07-12 10:41:33 · 385 阅读 · 0 评论 -
hdu1894String Compare
String CompareTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 2920 Accepted Submission(s): 696Problem DescriptionMaybe there are原创 2014-07-12 10:46:28 · 366 阅读 · 0 评论 -
C/C++ sort函数的用法
sort函数的用法做ACM题的时候,排序是一种经常要用到的操作。如果每次都自己写个冒泡之类的O(n^2)排序,不但程序容易超时,而且浪费宝贵的比赛时间,还很有可能写错。STL里面有个sort函数,可以直接对数组排序,复杂度为n*log2(n)。使用这个函数,需要包含头文件。 这个函数可以传两个参数或三个参数。第一个参数是要排序的区间首地址,第二个参数是区间尾地址的下一地址。也就是说,转载 2014-07-12 13:46:07 · 1063 阅读 · 0 评论 -
使用STL的next_permutation函数生成全排列(C++)
下午研究了一下全排列算法,然后发现C++的STL有一个函数可以方便地生成全排列,这就是next_permutation在C++ Reference中查看了一下next_permutation的函数声明:#include bool next_permutation( iterator start, iterator end );The next_permutation() funct转载 2014-07-12 10:24:31 · 428 阅读 · 0 评论 -
hdu1029Ignatius and the Princess IV
Ignatius and the Princess IVTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32767 K (Java/Others)Total Submission(s): 16291 Accepted Submission(s): 6565Problem Description"O原创 2014-07-12 10:52:37 · 401 阅读 · 0 评论 -
hdu1236排名
排名Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15093 Accepted Submission(s): 5475Problem Description今天的上机考试虽然有实时的Ranklist,但上面的原创 2014-07-12 11:52:33 · 359 阅读 · 0 评论 -
<STL介绍>--Queue用法
#include #include #include /*调用的时候要有头文件: #include 或 #include +#include #include详细用法:定义一个queue的变量 queue M查看是否为空范例 M.empty() 是的话返回1,不是返回0;从已有元素后面增加元素 M.push()输出转载 2014-07-11 22:02:23 · 409 阅读 · 0 评论 -
poj1363Rails
RailsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 24408 Accepted: 9564DescriptionThere is a famous railway station in PopPush City. Country there is in原创 2014-07-12 21:46:04 · 502 阅读 · 0 评论 -
C++中compare函数的使用
compare函数用来进行字符串以及其子串的比较,示例如下:转载 2014-07-11 21:52:56 · 1882 阅读 · 0 评论 -
poj2643Election
ElectionTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 3846 Accepted: 1824DescriptionCanada has a multi-party system of government. Each candidate is gen原创 2014-07-12 11:16:36 · 475 阅读 · 0 评论 -
hdu1031Design T-Shirt
Design T-ShirtTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5507 Accepted Submission(s): 2569Problem DescriptionSoon after he d原创 2014-07-12 11:28:39 · 476 阅读 · 0 评论 -
最小生成树prim算法实现
今天从转载 2014-07-31 11:25:08 · 433 阅读 · 0 评论