摘要: 快速排序什么是快速排序?快速排序其实是一种排序方法。其他不啰说;基本原理:给出一堆无序的数,首先重这堆数值中一第一个数为标杆(其他数也可以不过为了方便编程就选着第一个数为标杆),标杆选出后,将这堆无序数分成两堆,比标杆小的分到一堆,比标杆大的分到另一堆,这样就有两堆数了。接着按照同样的方法为这两堆数进行快速排序。写代码时第一步,找出标杆,以标杆为中心将比标杆小的数放到标杆右边,比标杆大的放到左边;在分别进入左右两边进行快排;假如start为数组起点end为数组终点排序函数为sort();k为标杆在数组中的下标;(1)sort(start,end)(2)sort(start,k-1)(3)sor 阅读全文
posted @ 2013-10-20 21:38 一只蚊子 阅读(159) 评论(0) 推荐(0) 编辑
摘要: What Are You Talking AboutTime Limit : 10000/5000ms (Java/Other)Memory Limit : 102400/204800K (Java/Other)Total Submission(s) : 43Accepted Submission(s) : 14Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem DescriptionIgnatius is so lucky that he met a Martian yesterday. But he didn' 阅读全文
posted @ 2013-08-25 11:25 一只蚊子 阅读(310) 评论(0) 推荐(0) 编辑
摘要: /**spfa 判断有没有负权值的边;1.把源点放进队列; 2.出队 用对头进行松弛操作 3松弛操作的点进队列; 3如果 改点在队列里就不用进队列; 2 .如果进队次数多于n;return ; */#include#includeusing namespace std;const int maxn=1000+10;const int INF=0x3ffffff;int map[maxn][maxn];int used[maxn];//总进队列次数;bool qused[maxn];//队列里的元素;int d... 阅读全文
posted @ 2013-08-20 11:49 一只蚊子 阅读(165) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;const int maxx=105;const int INF=1000000; int map[maxx][maxx];bool used[maxx];int dis[maxx];int mapsize;void init(int c){ int x,y,quan; for(x=0;x<maxx;x++) { used[x]=0; } for(x=0;x<maxx;x++) { dis[x]=INF; } for(x=0;x<maxx;x++)... 阅读全文
posted @ 2013-08-18 19:35 一只蚊子 阅读(197) 评论(0) 推荐(0) 编辑
摘要: Prime Ring ProblemTime Limit : 4000/2000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 13 Accepted Submission(s) : 5Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem DescriptionA ring is compose of n circles as shown in diagram. Put natural number 1, 2, .. 阅读全文
posted @ 2013-08-18 11:43 一只蚊子 阅读(246) 评论(0) 推荐(0) 编辑
摘要: Catch That CowTime Limit : 5000/2000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 68 Accepted Submission(s) : 18Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch 阅读全文
posted @ 2013-08-17 16:13 一只蚊子 阅读(178) 评论(0) 推荐(0) 编辑
摘要: Counting SheepTime Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 28 Accepted Submission(s) : 24Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem DescriptionA while ago I had trouble sleeping. I used to lie awake, staring at the ceiling, f 阅读全文
posted @ 2013-08-17 15:29 一只蚊子 阅读(227) 评论(0) 推荐(0) 编辑
摘要: Oil DepositsTime Limit : 2000/1000ms (Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 43Accepted Submission(s) : 19Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem DescriptionThe GeoSurvComp geologic survey company is responsible for detecting underground oil d 阅读全文
posted @ 2013-08-17 11:37 一只蚊子 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Red and BlackTime Limit : 2000/1000ms (Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 49Accepted Submission(s) : 30Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either r 阅读全文
posted @ 2013-08-17 10:31 一只蚊子 阅读(155) 评论(0) 推荐(0) 编辑
摘要: What Are You Talking AboutTime Limit : 10000/5000ms (Java/Other)Memory Limit : 102400/204800K (Java/Other)Total Submission(s) : 20Accepted Submission(s) : 6Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem DescriptionIgnatius is so lucky that he met a Martian yesterday. But he didn' 阅读全文
posted @ 2013-08-17 09:17 一只蚊子 阅读(252) 评论(0) 推荐(0) 编辑