2012年8月6日

poj2593

摘要: 题目链接:http://poj.org/problem?id=2593动态规划大意:给你一个数列,求数列中两个不重叠的子序列的最大和。 从左向右求得left[]数组,left[i]表示0~i之间的最大连续子序列。再从右往做左求最大子序列,然后求0~i,i+1~n-1的两段子序列中的最大和。 1 1 #include <stdio.h> 2 2 int main() 3 3 { 4 4 int left[100005]; 5 5 int right[100005]; 6 6 int a[100005]; 7 7 8 8 while(1) 9 ... 阅读全文

posted @ 2012-08-06 21:24 矮人狙击手! 阅读(988) 评论(0) 推荐(0) 编辑

qsort()与sort()

摘要: 转自:http://blog.163.com/fzu_q_q/blog/static/18645105720115270952949/sort和qsort使用差别2011-06-27 00:09:52|分类:默认分类|字号订阅一、对int类型数组排序int num[100];Sample:int cmp ( const void *a , const void *b ){return *(int *)a - *(int *)b;}qsort(num,100,sizeof(num[0]),cmp);二、对char类型数组排序(同int类型)char word[100];Sample:int cm 阅读全文

posted @ 2012-08-06 18:30 矮人狙击手! 阅读(1858) 评论(0) 推荐(1) 编辑

map

摘要: 转自:http://www.cnblogs.com/skynet/archive/2010/06/18/1760518.htmlMap是标准关联式容器(associativecontainer)之一,一个map是一个键值对序列,即(key ,value)对。它提供基于key的快速检索能力,在一个map中key值是唯一的。map提供双向迭代器,即有从前往后的(iterator),也有从后往前的(reverse_iterator)。map要求能对key进行<操作,且保持按key值递增有序,因此map上的迭代器也是递增有序的。如果对于元素并不需要保持有序,可以使用hash_map。map中ke 阅读全文

posted @ 2012-08-06 12:22 矮人狙击手! 阅读(352) 评论(0) 推荐(0) 编辑

poj2028

摘要: 水题一道啊,一次AC啊 1 #include <iostream> 2 #include <algorithm> 3 #include <cstring> 4 using namespace std; 5 6 int main() 7 { 8 int a[105]; 9 int res[105];10 int n,q,m;11 int i,j;12 while(1)13 {14 cin>>n>>q;15 if(n==0 && q==0) break;16 memset(res,0,sizeof(r... 阅读全文

posted @ 2012-08-06 10:45 矮人狙击手! 阅读(145) 评论(0) 推荐(0) 编辑

poj1083

摘要: 水题一道,看清房间到底是怎么分布的看清了啊,我就是第一次没有看清这才wa的 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 6 int cmp (int a,int b) 7 { 8 return a>b; 9 }10 int main()11 {12 int Case;13 cin>>Case;14 int from, to;15 int room[405];16 int i,j;17 while(Ca.. 阅读全文

posted @ 2012-08-06 09:57 矮人狙击手! 阅读(164) 评论(0) 推荐(0) 编辑

导航