题目:点击打开链接
分析:题目要求均匀产生随机数,有两种方法:1 对产生的数进行标记 2 要产生随机数STEP和MOD的最大公约数不能超过1
代码一:
#include
#include
int a1[100010];
int main()
{
int STEP,MOD;
while(~scanf("%d%d",&STEP,&MOD))
{
int i;
in...
分类:
其他好文 时间:
2015-08-12 11:39:17
阅读次数:
74
题意:找三个连续子序列a b c,满足a b对称且b c对称
思路:先求出序列中以每个位置为中心的回文串长度存在p[i]数组里,用manacher算法,O(n)的时间,然后遍历p数组,如果在当前位置的回文串范围内,与之后的位置上的回文串范围能覆盖彼此任意一个的至少一半,就说明满足条件,依此找出最优解
还在wa的同学可以试试我代码下面的数据
代码:
#include
#include
#...
分类:
其他好文 时间:
2015-08-12 11:38:09
阅读次数:
128
题目链接:
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=508题意:20个点的任意最短路。floyd代码:#include
#include
#include
#include
#...
分类:
其他好文 时间:
2015-08-12 11:35:41
阅读次数:
120
题目链接:
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=975题意:裸的最小生成树代码:#include
#include
#include
#include
#i...
分类:
其他好文 时间:
2015-08-12 11:33:15
阅读次数:
108
//LinkList.h 单链表#ifndef LINK_LIST_HXX#define LINK_LIST_HXX#include using namespace std;templatestruct Node{ T data; Node * next;};templateclass Li...
分类:
编程语言 时间:
2015-08-12 11:25:35
阅读次数:
154
#include
using namespace std;
typedef struct Relation_
{
int first;
int end;
}Re;
typedef struct Leader_
{
int mun;
int*pResult;
}Le;
Le GetLeader(int Sum,int M,Re*pRelation)
{
int i=0;
int*p1...
分类:
其他好文 时间:
2015-08-12 10:14:04
阅读次数:
137
我想不大理解二级指针的根源是我对程序对堆栈的用法还不够深入了解。
采用一级指针最好是方便修改指针对象的值,采用二级指针最好是方便修改指针的值。#include
#include
using namespace std;class haha
{
};
void main()
{ haha *p(new haha);
printf("%p\n",...
分类:
其他好文 时间:
2015-08-12 10:11:56
阅读次数:
113
强连通分量+缩点#include#include#include#include#includeusing namespace std;const int maxn=10000+10;vectorG[maxn];vectorFG[maxn];int Flag[maxn];int n,m,tot;in...
分类:
其他好文 时间:
2015-08-12 10:11:27
阅读次数:
116
use-default-filters=true 默认行为会自动扫描所有注解com.fleet下的包及其子包注解都会扫描到,这就会有一个问题,就是对于include-filter标签不会起作用只有当use-default-filters=false才会有用,,但是,exclude-filter会起作...
分类:
其他好文 时间:
2015-08-12 10:11:24
阅读次数:
159
#include
struct a{
char x[6];
int y;
char z[6];
};
struct b{
int y;
char x[6];
char z[6];
};
union c{
char x[6];
int y;
char z[6];
};
int main()
{
printf("%d,%d,%d\n",sizeof(struct a),sizeof...
分类:
其他好文 时间:
2015-08-12 09:05:04
阅读次数:
81