05 2017 档案

摘要:#include #include #include #include #include #include #include #include #include #include using namespace std; #define MaxSize 1000005 #define inf 0x3f3f3f3f #define LL long long int int n,m; int... 阅读全文
posted @ 2017-05-31 11:02 kimsimple 阅读(175) 评论(0) 推荐(0)
摘要:hdu 1153 magic bitstrings 题目大意 一个质数p,现在让你求一个p-1长度的“01魔法串”。关于这个魔法串是这么定义的: 我们现在把这个串经过一段处理变成一个长宽均为p-1的矩阵,对于第i行的串,是由原来的串按每i位取得的。如果这个矩阵每行的串满足:和原来的串相等或是原来的串 阅读全文
posted @ 2017-05-31 10:05 kimsimple 阅读(363) 评论(0) 推荐(0)
摘要:其他类型转字符串 itoa 功 能:把一整数转换为字符串用 法:char *itoa(int value, char *string, int radix);详细解释:itoa是英文integer to array(将int整型数转化为一个字符串,并将值保存在数组string中)的缩写.其中valu 阅读全文
posted @ 2017-05-31 10:04 kimsimple 阅读(776) 评论(0) 推荐(0)
摘要:岳父与小明:农夫约翰有N头牛排成一列,他从第A头牛到第B头牛里挑出最高的那头取名叫岳父,最矮的那头取名叫小明。求岳父与小明的身高差? 即 给出初始化的区间值,m次查询 每次查询区间[a,b]的最大值-最小值 题目大意: 给出初始化的区间值,m次查询 每次查询区间[a,b]的最大值-最小值 解题思路: 阅读全文
posted @ 2017-05-31 10:03 kimsimple 阅读(174) 评论(0) 推荐(0)
摘要:拓扑排序: 拓扑排序是应用于有向无回路图(DAG)上的一种排序方式,对一个有向无回路进行拓扑排序后,所有的顶点形成一个序列,对所有边(u,v),满足u在v的前面。该序列说明了顶点表示的事件或 状态发生的整体顺序。 比较经典的是在工程活动上,某些工程完成后,另一些工程才能继续,此时可以以工程为顶点,工 阅读全文
posted @ 2017-05-31 10:03 kimsimple 阅读(343) 评论(0) 推荐(0)
摘要:#include #include #include #include #include using namespace std; #define N 2000010 char s[N],p[N]; int next1[N]; int kmp(char* s, char* p) { int num=0; int i = 0; int j = 0; ... 阅读全文
posted @ 2017-05-30 21:37 kimsimple 阅读(134) 评论(0) 推荐(0)
摘要:map巧过 经典字典树(前缀树) 第一个字典树(G++内存超限),第二个map(红黑树),对于此类问题,字典树效率优势明显 hihoCoder1014 阅读全文
posted @ 2017-05-30 12:21 kimsimple 阅读(183) 评论(0) 推荐(0)
摘要:知前序遍历与中序遍历 求后序遍历 阅读全文
posted @ 2017-05-25 17:27 kimsimple 阅读(207) 评论(0) 推荐(0)
摘要:#include #include #include #include #include using namespace std; int main() { int T, m; cin >> T; while(T--) { map >mp; string place, name; int num; ... 阅读全文
posted @ 2017-05-21 23:35 kimsimple 阅读(335) 评论(0) 推荐(0)
摘要:滚动数组的作用在于优化空间,主要应用在递推或动态规划中(如01背包问题)。因为DP题目是一个自底向上的扩展过程,我们常常需要用到的是连续的解,前面的解往往可以舍去。所以用滚动数组优化是很有效的。利用滚动数组的话在N很大的情况下可以达到压缩存储的作用。 一个简单的例子: 斐波那契数列: 滚动数组实际是 阅读全文
posted @ 2017-05-21 09:01 kimsimple 阅读(4280) 评论(0) 推荐(2)
摘要:三种编程命名规范(匈牙利命名法、驼峰式命名法、帕斯卡命名法) 1 . 匈牙利命名: 开头字母用变量类型的缩写,其余部分用变量的英文或英文的缩写,要求单词第一个字母大写。 ex: int iMyAge; “i”是int类型的缩写; char cMyName[10]; “c”是char类型的缩写; fl 阅读全文
posted @ 2017-05-21 08:17 kimsimple 阅读(3978) 评论(0) 推荐(0)
摘要:#include #include using namespace std; typedef long long ll; const int MAXN = 2e5 + 10; int A[MAXN]; int B[MAXN]; bool vis[MAXN]; int abs(int a) { return a < 0 ? -a : a; } int main () {... 阅读全文
posted @ 2017-05-20 23:41 kimsimple 阅读(398) 评论(0) 推荐(0)
摘要:交换相邻两数 如果只是交换相邻两数,那么最少交换次数为该序列的逆序数。 交换任意两数 数字的总个数减去循环节的个数?? A cycle is a set of elements, each of which is in the place of another. So in example sequ 阅读全文
posted @ 2017-05-20 23:25 kimsimple 阅读(6264) 评论(0) 推荐(0)
摘要:经常看人写#include <bits/stdc++.h>却不知道是干啥的? #include<bits/stdc++.h>包含了目前c++所包含的所有头文件 对比: 这么神奇?可以这么轻松? 兼容性问题: 注意,目前POJ还不支持<bits/stdc++.h>(G++、C++都不支持)。HDU部分 阅读全文
posted @ 2017-05-18 18:48 kimsimple 阅读(22639) 评论(1) 推荐(1)
摘要:输入n,紧接n行,每行a,b n个气球,a,b表示从第a到第b个气球涂一次色,输出每个球最终的涂几次色 暴力超时,优化数据结构 1.树状数组 2.线段树 3.奇技淫巧 从此题discuss中看到 每个气球有两属性 作为起点的次数st 作为终点的次数ed 一共享变量sum_st记录到当前点的所有作为染 阅读全文
posted @ 2017-05-16 22:31 kimsimple 阅读(432) 评论(0) 推荐(0)
摘要:E. 黑心啤酒厂 Time limit per test: 1.0 seconds Time limit all tests: 1.0 seconds Memory limit: 256 megabytes Accept / Submit: 1184 / 4093 E. 黑心啤酒厂 Time lim 阅读全文
posted @ 2017-05-15 23:46 kimsimple 阅读(296) 评论(0) 推荐(0)
摘要:我们的个人信息为什么会被盗呢?原因之一是我们的电脑有漏洞,通俗的说,门窗关闭不严。 默认情况下,Windows有很多端口是开放的,在你上网的时候,网络病毒和黑客可以通过这些端口连上你的电脑。 为了让你的系统变为铜墙铁壁,应该封闭这些端口,主要有:TCP 135、139、445、593、1025 端口 阅读全文
posted @ 2017-05-13 22:45 kimsimple 阅读(4937) 评论(0) 推荐(0)
摘要:感谢:巴氏(bash)威佐夫(Wythoff)尼姆(Nim)博弈之模板 转自:http://colorfulshark.cn/wordpress/巴氏(bash)威佐夫(wythoff)尼姆(nim)博弈之模板-823.html 最近研究了一下博弈论(听起来很高大上),当然,这只是博弈论中的冰山一角 阅读全文
posted @ 2017-05-01 23:12 kimsimple 阅读(585) 评论(0) 推荐(0)
摘要:感谢:http://blog.csdn.net/mirror58229/article/details/63685884 题意:x+y=a lcm(x,y)=b 求x,y 12WCases + b 10^9 + a 10^4 所以肯定不是枚举……肯定是公式题 接下来就是转化 x+y=a x*y/gc 阅读全文
posted @ 2017-05-01 18:23 kimsimple 阅读(1400) 评论(0) 推荐(0)