using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 建一个判断是否为闰年的方法_函数_{ class Program { /// ...
分类:
其他好文 时间:
2015-06-16 01:11:56
阅读次数:
202
比如主串为:”1001110110”
子串为:”11“
则出现位置分别为:3 4 7//KMP算法 2015.6.7#include
#include
using namespace std;int main()
{
char *s = "1001110110";
char *p = "11";
int ar[20] = {...
分类:
编程语言 时间:
2015-06-15 23:59:17
阅读次数:
340
http://acm.hdu.edu.cn/showproblem.php?pid=3006注意到集合内数字最大只有14,状态压缩一下,然后枚举出所有状态#include #include #include using namespace std;int dp[1<<15];int main() {...
分类:
其他好文 时间:
2015-06-15 23:52:58
阅读次数:
128
Problem E.GukiZ and GukiZianaSolution: 先分成N=sqrt(n)块,然后对这N块进行排序。 利用二分查找确定最前面和最后面的位置。 #include using namespace std;typedef long long ll;vector s[100...
分类:
其他好文 时间:
2015-06-15 23:27:53
阅读次数:
321
http://poj.org/problem?id=3259
之前一开始 ,没做出来,搁置了好几天才看见bug所在。所以今天a掉了 ,把代码贴出来,这个使用邻接矩阵表示的 ,下一篇用邻接表可以提高效率。
#include
#include
#include
#include
using namespace std;
const int INF=600;
int G[INF][INF];
...
分类:
编程语言 时间:
2015-06-15 22:15:49
阅读次数:
171
23333......简单的并查集模板。就是被并查集递归式路径压缩RE坑过。。。学习一下非递归式路径压缩。附代码:#include#include#include#define maxn 30100using namespace std;int fa[maxn];int n, m, k;void i...
分类:
其他好文 时间:
2015-06-15 21:51:55
阅读次数:
99
代码: 1 #include 2 #include 3 4 using namespace std; 5 6 void getResult(vector> &result, vector element, vector nums) 7 { 8 if (element.size() == ...
分类:
其他好文 时间:
2015-06-15 20:20:02
阅读次数:
117
/*如果采用单向链表,end()函数如何表示?
*所以必须得采用循环链表的方式?
*
*/
#ifndef LIST
#define LIST
#include
using namespace std;
//声明
template
struct Node{
T data;
struct Node* next;
Node(struct Node* p):data(p->data...
分类:
其他好文 时间:
2015-06-15 18:54:37
阅读次数:
112
一般的模拟题。对于出现过的每一个x建立一个set 集合,对于y也如此。然后查找要走到哪个点即可,主要要对状态记录,判断是否无线循环,否者出现无线循环的情况,就tle了。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
con...
分类:
其他好文 时间:
2015-06-15 18:45:08
阅读次数:
150
1.c++语言标准输入输出流控制符的用法#include #include using namespace std;int main(){ int x=30,y=300,z=1024; cout#include using namespace std;int main(){ int...
分类:
编程语言 时间:
2015-06-15 17:58:58
阅读次数:
166