就是个裸题了
#include
#include
#include
#include
#define cl(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
inline char nc()
{
static char buf[100000],*p1=buf,*p2=buf;
if (p1==p2...
分类:
其他好文 时间:
2016-05-13 02:29:07
阅读次数:
413
跟悬线法有点像
#include
#include
#include
#include
#define cl(x) memset(x,0,sizeof(x))
using namespace std;
inline char nc()
{
static char buf[100000],*p1=buf,*p2=buf;
if (p1==p2) { p2=(p1=buf)+fread...
分类:
编程语言 时间:
2016-05-13 01:34:49
阅读次数:
248
【题目链接】
点分治。
考虑经过点x的路径,对于x,用类似TreeDP的方法,记录no[d],表示路径长度为d时经过边最少的点的编号。
对于已经走过的子树,更新no。对于当前子树,遍历到一个点v,用depth[no[k - dis[v]]] + depth[v]更新答案。
注意给no清零时,用dfs姿势清零,这样做是O(n)的。如果直接用for或者memset,这样做是O(k)的,...
分类:
其他好文 时间:
2016-05-12 21:39:13
阅读次数:
200
#include
#include
#include
#include
#include
#define maxn 2000
#define base 10000
using namespace std;
int n;
struct Bign
{
int c[maxn],len,sign;
//初始化
Bign(){memset(c,0,sizeof(c)),len = 1,sign = ...
分类:
其他好文 时间:
2016-05-12 21:25:07
阅读次数:
138
dijkstra算法模板:
Int visited[i]//结点i若被访问则为1,没有则为0
Int dist[i]// 目前结点j到其他各结点的最短路的长度
Int w[i][j]//边(i,j)的权值
初始化:(结点1~n)
memset(v,0,sizeof(v));
dist[j]=0;
dist[i]=inf;(i>=1&&i>a>>b>>x;
...
分类:
编程语言 时间:
2016-05-12 20:44:26
阅读次数:
199
#include
#include
#include
#include
using namespace std;
#define maxn 2000
#define base 10000
struct Bign
{
int c[maxn],len,sign;
//初始化
Bign(){memset(c,0,sizeof(c)),len = 1,sign = 0;}
//高位清零...
分类:
编程语言 时间:
2016-05-12 19:18:51
阅读次数:
240
题目:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=24269
代码:
#include
#include
#include
using namespace std;
int dp[15][10];
int ans;
int bit[15];
void init()
{
memset(dp,0,sizeof...
【转载自 http://blog.sina.com.cn/s/blog_715d0ae30100yj2d.html】 功 能: 将s所指向的某一块内存中的每个字节的内容全部设置为ch指定的ASCII值, 块的大小由第三个参数指定,这个函数通常为新申请的内存做初始化工作 用 法: void *mems ...
分类:
编程语言 时间:
2016-05-08 16:53:06
阅读次数:
218
题目链接UVa11107 Lifeform题解
学了高大上的后缀数组但是还是不怎么会用,关键是版子最开始打错了,害得我必须再重新理解一遍才能找出bug,开始以为是memset(sa,0,sizeof(sa))这句少写了但是并不是这样.话说字符串的题特别容易RE.
这道题二分答案然后后缀数组,先将字符串合并,每个串后加一个奇怪的不相同的字符,二分长度,然后在height数...
分类:
其他好文 时间:
2016-05-07 10:04:12
阅读次数:
166
memset()函数原型是extern void *memset(void *buffer, int c, int count) buffer:为指针或是数组, c:是赋给buffer的值, count:是buffer的长度. 这个函数在socket中多用于清空数组.如:原型是memset(buff ...
分类:
其他好文 时间:
2016-05-04 22:37:19
阅读次数:
160