- 博客(85)
- 资源 (1)
- 收藏
- 关注
原创 C++ Prime学习过程中的细节摘记(三)
最近在学C++,在看C++ Prime(第三版)的过程中把一些零星的知识点记了下来,主要是一些细节问题,便于以后回过头来查阅和巩固。1.函数1.1函数参数传递:C++的函数参数传递是值传递的,但是按值传递在一些情况下不是很适合1.当大型类对象必须作为参数传递时,分配对象需要拷贝,需要很大的开销2.当实参必须要被修改时此时需要用指针或引用作为参数传递给函数
2013-05-17 22:44:54
1049
原创 C++ Prime学习过程中的细节摘记(二)
最近在学C++,在看C++ Prime(第三版)的过程中把一些零星的知识点记了下来,主要是一些细节问题,便于以后回过头来查阅和巩固。表达式 1.复数操作 * 可以用一个算术数据类型的值初始化一个复数,但不能用一个复数对象初始化算术数据类型(不支持隐式类型转换)。 * C++支持复数对象的输出,输出包括一个括号,实部和虚部由一个逗号分
2013-05-14 20:13:55
1025
原创 C++ Prime学习过程中的细节摘记(一)
最近在学C++,在看C++ Prime(第三版)的过程中把一些零星的知识点记了下来,主要是一些细节问题,便于以后回过头来查阅和巩固。C++数据类型1.字符串类型:* string类型的字符串可以自动将C风格的字符串转换为string对象,相反转化不支持,可以通过c_str()操作显式转化。* string类的c_str方法返回的是指向const类型的数组。 2.
2013-05-14 12:53:05
1161
原创 ZOJ-1203 Swordfish
SwordfishTime Limit: 2 Seconds Memory Limit: 65536 KBThere exists a world within our worldA world beneath what we call cyberspace.A world protected by firewalls,passwords and the mo
2013-05-12 09:57:59
1051
原创 ZOJ-1060 Sorting It All Out
Sorting It All OutTime Limit: 2 Seconds Memory Limit: 65536 KBAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elemen
2013-05-12 09:56:47
677
原创 ZOJ-1589 Professor John
Professor JohnTime Limit: 2 Seconds Memory Limit: 65536 KBSunny Cup 2003 - Preliminary RoundApril 20th, 12:00 - 17:00Problem H: Professor JohnProfessor John is investigating a mat
2013-05-12 09:54:53
1346
原创 ZOJ-1085 Alien Security
Alien SecurityTime Limit: 2 Seconds Memory Limit: 65536 KBYou are in charge of security at a top-secret government research facility. Recently your government has captured a live extra-te
2013-05-12 09:53:04
1022
原创 ZOJ-2165 Red and Black
Red and BlackTime Limit: 2 Seconds Memory Limit: 65536 KBThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black til
2013-05-12 09:49:26
894
原创 HDU-2533 N皇后问题
N皇后问题Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4974 Accepted Submission(s): 2274Problem Description在N*N的方格棋盘放置了N个皇后,使得它
2013-05-12 09:47:49
663
原创 HDU-1728 逃离迷宫
逃离迷宫Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9436 Accepted Submission(s): 2222Problem Description 给定一个m × n (m行, n列)的
2013-05-12 09:45:45
656
原创 ZOJ-2002 Copying Books
Copying BooksTime Limit: 2 Seconds Memory Limit: 65536 KBBefore the invention of book-printing, it was very hard to make a copy of a book. All the contents had to be re-written by hand by
2013-05-12 09:43:56
801
原创 ZOJ-1756 Robots
RobotsTime Limit: 2 Seconds Memory Limit: 65536 KBYour company provides robots that can be used to pick up litter from fields after sporting events and concerts. Before robots are assigne
2013-05-12 09:42:16
777
原创 ZOJ-1877 Bridge
BridgeTime Limit: 2 Seconds Memory Limit: 65536 KB Special Judgen people wish to cross a bridge at night. A group of at most two people may cross at any time, and each group must hav
2013-05-12 09:38:26
1367
原创 ZOJ-1082 Stockbroker Grapevine
Stockbroker GrapevineTime Limit: 2 Seconds Memory Limit: 65536 KBStockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation a
2013-05-12 09:35:22
761
原创 ZOJ-1360 Radar Installation
Radar InstallationTime Limit: 2 Seconds Memory Limit: 65536 KBAssume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a p
2013-05-12 09:32:40
615
原创 ZOJ-1076 Gene Assembly
Gene AssemblyTime Limit: 2 Seconds Memory Limit: 65536 KBStatement of the ProblemWith the large amount of genomic DNA sequence data being made available, it is becoming more important t
2013-05-12 09:28:32
704
原创 ZOJ-1834 AutoFish
AutoFishTime Limit: 2 Seconds Memory Limit: 65536 KBYou've built an amazing fish-catching robot, but you've discovered one small flaw: the robot can't decide whether to fish or cut ba
2013-05-12 09:26:11
815
转载 25个Vim教程、视频和资源
英文原文:Jeffrey Way 编译:伯乐在线 - 唐尤华编注:@程序员的那些事 12月14日在新浪微博发起的《你最常用哪些文本编辑器?》。根据目前的投票结果显示,Vim 以 43% 比例排第一。在进行30天Vim特训过程中,我发现了数量众多的优秀教程、资源甚至视频。如果你像我一样刚刚开始钻研这个优秀的开源编辑器,希望下面的内容能助你一臂之力。视频
2013-05-04 12:49:08
1234
转载 ACM中国国家集训队论文集目录(1999-2009)
国家集训队1999论文集陈宏:《数据结构的选择与算法效率——从IOI98试题PICTURE谈起》来煜坤:《把握本质,灵活运用——动态规划的深入探讨》齐鑫:《搜索方法中的剪枝优化》邵铮:《数学模型的建立、比较和应用》石润婷:《隐蔽化、多维化、开放化——论当今信息学竞赛中数学建模的灵活性》杨帆:《准确性、全面性、美观性——测试数据设计中的三要素》周咏基:《论随机化算
2013-05-04 01:36:22
1513
原创 ZOJ-1236 Eat or Not to Eat?
Eat or Not to Eat?Time Limit: 10 Seconds MemoryLimit: 32768 KBA young farmer hasN cows, but they produced really really a very very small amount of milk. Johncannot live on the mi
2013-04-15 13:07:28
731
原创 ZOJ-2240 Run Length Encoding
Run Length EncodingTime Limit: 2 Seconds MemoryLimit: 65536 KBYour task is towrite a program that performs a simple form of run-length encoding, asdescribed by the rules below.A
2013-04-15 13:06:11
759
原创 ZOJ-1072 MicroprocessorSimulation
MicroprocessorSimulationTime Limit: 2 Seconds MemoryLimit: 65536 KBProblemConsider a small microprocessor that has the following properties:Each word is four bits.Addres
2013-04-15 13:04:09
1010
原创 ZOJ-1208 Roll the Die!
Roll the Die!Time Limit: 2 Seconds MemoryLimit: 65536 KBA gambler's die(Figure 1) is a cube whose six faces are labeled with 1, 2, 3, 4, 5, and 6dots, respectively.Each of the
2013-04-15 13:02:25
912
原创 ZOJ-1737 Unreliable Message
Unreliable MessageTime Limit: 2 Seconds MemoryLimit: 65536 KBTheKing of a little Kingdom on a little island in the Pacific Ocean frequently haschildish ideas. One day he said, "Yo
2013-04-15 12:59:52
877
原创 ZOJ-1862 Mine Sweeper
Mine SweeperTime Limit: 2 Seconds MemoryLimit: 65536 KBThe gameMinesweeper is played on an n by n grid. In this grid are hidden m mines, eachat a distinct grid location. The playe
2013-04-15 12:56:53
1000
原创 ZOJ-1824 Maze Traversal
Maze TraversalTime Limit: 2 Seconds MemoryLimit: 65536 KBAcommon problem in artificial intelligence is negotiation of a maze. A maze hascorridors and walls. The robot can proceed
2013-04-15 12:54:36
1203
原创 ZOJ-1986 Bridging Signals
Bridging SignalsTime Limit: 2 Seconds MemoryLimit: 65536 KB'Oh no, they'vedone it again', cries the chief designer at the Waferland chip factory. Oncemore the routing designers ha
2013-04-15 12:49:13
591
转载 一位ACMer过来人的心得
刻苦的训练我打算最后稍微提一下。主要说后者:什么是有效地训练? 我想说下我的理解。 很多ACMer入门的时候,都被告知:要多做题,做个500多道就变牛了。其实,这既不是充分条件、也不会是必要条件。 我觉得一般情况下,对于我们普通学校的大学生,各方面能力的差距不会太大,在这种情况下,训练和学习的方法尤为重要。 其实,500题
2013-04-02 22:13:09
623
原创 基数排序
基数排序算法思路:将所有待比较数值(正整数)统一为同样的数位长度,数位较短的数前面补零。然后,从最低位开始,依次进行一次排序。这样从最低位排序一直到最高位排序完成以后, 数列就变成一个有序序列。基数排序的方式可以采用LSD(Leastsignificant digital)或MSD(Most significant digital),LSD的排序方式由键值的最右边开始,而MSD则相反,
2013-03-19 20:10:31
760
原创 归并排序
归并排序归并(Merge)排序法是将两个(或两个以上)有序表合并成一个新的有序表,即把待排序序列分为若干个子序列,每个子序列是有序的。然后再把有序子序列合并为整体有序序列。归并排序是建立在归并操作上的一种有效的排序算法。该算法是采用分治法(Divide and Conquer)的一个非常典型的应用。将已有序的子序列合并,得到完全有序的序列;即先使每个子序列有序,再使子序列段间有序。
2013-03-18 16:05:03
865
原创 堆排序
堆排序堆排序是通过数据结构中的树的结构进行排序的过程。堆:n个关键字序列Kl,K2,…,Kn称为(Heap),当且仅当该序列满足如下性质(简称为堆性质):ki>=号。//k(i)相当于二叉树的非叶结点,K(2i)则是左孩子,k(2i+1)是右孩子堆排序:堆排序利用了大根堆(或小根堆)堆顶记录的关键字最大(或最小)这一特征,使得在当前无序区中选取最大(或最小)关键字的
2013-03-17 21:48:39
845
原创 快速排序及其变种算法
快速排序快速排序(Quicksort)是对冒泡排序的一种改进。由C. A. R. Hoare在1962年提出。它的基本思想是:通过一趟排序将要排序的数据分割成独立的两部分,其中一部分的所有数据都比另外一部分的所有数据都要小,然后再按此方法对这两部分数据分别进行快速排序,整个排序过程可以递归进行,以此达到整个数据变成有序序列。1) 递归实现的快速排序算法用分治法处理待排序数
2013-03-17 21:45:54
2046
原创 希尔排序
希尔排序希尔排序又叫缩小增量排序,也是一直插入排序算法,是直接插入排序的一种改进。算法思路:先取一个小于n的整数dk作为第一个增量,将array分成dk组,将所有相距dk的倍数的元素分到同一个组中,先在各自组内进行直接插入排序,然后逐步减小增量dk的大小,直到dk的值为1,这时就是一个对所有元素的直接插入排序,排序结束。希尔排序的C++实现:/***********
2013-03-14 19:53:51
810
原创 直接插入排序
直接插入排序直接插入排序是每次把无序序列中的第一个元素,然后插入到有序序列的合适位置,即排序过程中会出现两部分,一部分是已排序的有序序列,还有一部分是待排序的无序序列。排序过程通过一个二重循环实现。外层循环确定下一个待排序的值,即无序序列的第一个元素,内层循环实现对待排序元素插入位置的查找。 直接插入排序C++实现:/**********************
2013-03-13 18:56:02
767
原创 鸡尾酒排序
鸡尾酒排序(双端冒泡排序)鸡尾酒排序也叫定向冒泡排序,搅拌排序等,是冒泡排序的一种变形。鸡尾酒排序是在两端开始排序的,而冒泡排序时在一端进行的。鸡尾酒排序的C++实现: /**************************** *Name:鸡尾酒排序.cpp(双端冒泡排序) *Tags:排序 *Note: ***********************
2013-03-12 19:50:15
895
原创 冒泡排序
冒泡排序冒泡排序是一个最基本,最简单的交换排序算法,也是学C语言第一次接触的排序算法。冒泡排序的基本思想是:依次比较相邻的两个数,将小数放在前面,大数放在后面。由于过程像一个冒泡的过程,所以有了这个形象的名字。冒泡排序在一个二重循环中进行,所以时间复杂度为O(n^2)冒泡排序的C++语言实现: /**************************** *
2013-03-12 19:47:18
861
原创 寒假学习总结
寒假学习总结 今天已经是二月的最后一天了,开学已经两天了。在过去的一个寒假,虽然时间短暂,但多少有些收获,现在对这个寒假的学习生活来一个小小的总结。 在寒假中,主要学习的是有关ACM的一些必须的算法。同时也在刷刷题,练习练习自己的编程能力,美其名曰:积累代码量。 在寒假中,学习了基本的一些搜索算法,主要学习了广度优先搜索和深度优先搜
2013-02-28 20:59:19
1252
原创 杭电OJ题 1753 大明A+B 解题报告
大明A+BTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5651 Accepted Submission(s): 1917Problem Description话说,经过了漫长的一个多月,小明
2013-02-27 22:02:56
708
原创 杭电OJ题 1715 大菲波数 解题报告
大菲波数Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7529 Accepted Submission(s): 2511Problem DescriptionFibonacci数列,定义如下:
2013-02-27 21:59:39
615
原创 杭电OJ题 1047 Integer Inquiry 解题报告
Integer InquiryTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8039 Accepted Submission(s): 2058Problem DescriptionOne of
2013-02-27 21:56:32
863
《人月神话》txt格式
2013-01-18
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人