2013年10月2日
摘要: 1 #include 2 #include //取随机数用时间做种 3 #include 4 #include //计算用时 5 #include 6 #include //输出文件用 7 #include // 8 using namespace std; 9 int NUM = 100; //要排序的数目 10 int NUM_PER_LINE = 7;//每行输出多少个数 11 void insertion_sort(int *,int ,int); 12 void quickSort(int *p ,int start,int end); 13 v... 阅读全文
posted @ 2013-10-02 21:02 雪落尘 阅读(217) 评论(0) 推荐(0)
  2013年6月3日
摘要: 【题目描述】我们定义一个整数区间[a,b],a,b是一个从a开始至b结束的连续整数的集合。编一个程序,对给定的n个区间,找出满足下述条件的所含元素个数最少的集合中元素的个数:对于所给定的每一个区间,都至少有两个不同的整数属于该集合。(1<=n<=10000,0<=a<=b<=1000)输入输出格式:输入:第一行一个正整数n,接下来有n行,每行给定一个区间的a,b值输出:一个正整数,即满足条件的集合所包含的最少元素个数输入输出样例输入:输出:4436240247【算法分析】本题数据规模较大,用搜索做会超时,而动态规划无从下手。考虑贪心算法。题目意思是要找一个集合,该 阅读全文
posted @ 2013-06-03 18:04 雪落尘 阅读(998) 评论(0) 推荐(0)
  2013年5月30日
摘要: #include <stdio.h>#include <string.h>int main(){int n;scanf("%d",&n);while (n--){int m,r;char c[25];scanf("%d%d%s",&m,&r,c);printf("%d ",m);for (int j= 0; j < strlen(c); j++)for (int i=0;i<r;i++){printf("%c",c[j]);}printf("\n 阅读全文
posted @ 2013-05-30 15:49 雪落尘 阅读(95) 评论(0) 推荐(0)
摘要: #include <string>#include <vector>#include <iostream>#include <algorithm>using namespace std;bool vv(const string & a,const string &b){if (a.length() > b.length())return 0;else if (a.length() < b.length())return 1;elsereturn a<b;}int main(){for (int m,n;cin&g 阅读全文
posted @ 2013-05-30 15:40 雪落尘 阅读(90) 评论(0) 推荐(0)
  2013年5月29日
摘要: #include <stdio.h>int main(){ int n; scanf("%d",&n); int sum =0; while ( n-- ) { int m; scanf("%d",&m); int summ = 0,p; while (m--) { scanf("%d",&p); summ += p; } printf("%d cleared\n",summ); sum += summ; ... 阅读全文
posted @ 2013-05-29 20:30 雪落尘 阅读(125) 评论(0) 推荐(0)
  2013年5月26日
摘要: E - 挽尊Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit StatusDescription给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 <= i <= j <= K。最大连续子序列是所有连续子序列中元素和最大的一个, 例如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序 阅读全文
posted @ 2013-05-26 13:36 雪落尘 阅读(318) 评论(0) 推荐(0)
  2013年5月17日
摘要: 1 #include <vector> 2 #include <string> 3 #include <iostream> 4 #include <algorithm> 5 using namespace std; 6 bool vv(const string a,const string b) 7 { 8 return a.length()<b.length(); 9 }10 bool issub(string a,string b)11 {12 for (int i=0;i<=b.length()-a.length();i++)1 阅读全文
posted @ 2013-05-17 16:19 雪落尘 阅读(172) 评论(0) 推荐(0)