随笔分类 - ACM_数据结构
摘要:例题链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=138代码目的:复习哈希用代码实现: 1 #include "stdio.h" //nyoj 138 简单哈希 2 #include "vector" 3 using namespace s...
阅读全文
摘要:前情:因平常写代码是常将比较函数弄混(写好了排序还要确认一下-.-!),还是写篇博客,方便以后查阅C语言qsort函数对int类型数组排序: 1 #include "stdio.h" 2 #include "stdlib.h" 3 #define N 1005 4 int a[N]; 5 6 //...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1711问题描述:给两个序列a,b,长度分别为n,m(1<=n<=1000000,1<=m<=10000),问序列b是否为序列a的子序列,若是:返回a中最左边的与b相等的子序列的首元素下标;若不是,输出-1...
阅读全文
摘要:问题来源:第五届蓝桥杯预赛 C/C++本科B组第10题问题描述:n个小朋友,身高分别为h1,h2,...hk,...,hn,站成一排,现在要把他们按身高从低到高的顺序排列,但是每次只能交换位置相邻的两个小朋友。每个小朋友都有一个不高兴的程度。开始的时候,所有小朋友的不高兴程度都是0。如果某个小朋友第...
阅读全文
摘要:对各种排序算法的实现1.冒泡排序: 1 #include "stdio.h" 2 #define N 100005 3 4 void Swap(int *x,int *y){ int k=*x; *x=*y; *y=k; } 5 6 void Bubble_sort(int st,int en,...
阅读全文
摘要:题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=35题目: 表达式求值 时间限制:3000 ms | 内存限制:65535 KB描述 ACM队的mdd想做一个计算器,...
阅读全文
摘要:例题来源:题目:1468: Post office题目描述There are N(N0; i-=Low(i))15 ans += sum[i];16 return ans;17 }18 19 int main()20 {21 long long n;22 lo...
阅读全文
摘要:病毒侵袭Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9363Accepted Submission(s): 2444Problem Descri...
阅读全文
摘要:Count the ColorsTime Limit:2 Seconds Memory Limit:65536 KBPainting some colored segments on a line, some previously painted segments may be covered by...
阅读全文
摘要:A Simple Problem with IntegersTime Limit:5000MSMemory Limit:131072KTotal Submissions:53749Accepted:16131Case Time Limit:2000MSDescriptionYou haveNinte...
阅读全文
摘要:随笔目的:方便以后对树状数组(BIT)以及基本线段树的回顾例题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1166例题:hdu 1166敌兵布阵 Time Limit: 2000/1000 MS (Jav...
阅读全文
摘要:例题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1251代码: 1 #include "stdio.h" // 字典树模板题 hdu 1251 2 #include "string.h" 3 #include "stdlib.h" 4 5 struc...
阅读全文
摘要:鉴于在网上找的代码和我心中的好代码相差较大,贴个自己写的,不好莫怪哈~~题目链接:http://poj.org/problem?id=3468代码实现: 1 #include "stdio.h" //线段树成段更新 poj 3468 2 #include "string.h" 3 #incl...
阅读全文
浙公网安备 33010602011771号