#include
using namespace std;
template
struct tcontainer
{
virtual void push(const t&) = 0;
virtual void pop() = 0;
virtual const t& begin() = 0;
virtual const t& end() = 0;
virtual size_t si...
分类:
其他好文 时间:
2015-07-28 21:17:50
阅读次数:
177
首先计算出所有的f,这里容易超时,注意对优化。 易知f中的最大值为7,然后用一个数组d[i][j]记录f[1]到f[i]中有多少个j,这个用递推可得。 那么如果给定区间L, R, 则f[R][j] - f[L - 1][j]可算出1到7各出现了多少次, 根据这些次数就可以找出最大公约数了。代码如下:
#include
#include
#include
using namespace s...
分类:
其他好文 时间:
2015-07-28 21:16:48
阅读次数:
140
测试环境:windows 7 vs2010
主要实现二叉树的初始化递归和非递归遍历,层次遍历,获取叶子节点的个数,获取树的高度以及镜像树,部分代码也参考了互联网上的相关资料。
源程序:
BinaryTreeNode.h
#ifndef _BINARY_NODE
#define _BINARY_NODE
#include
using namespace std;
template
st...
分类:
编程语言 时间:
2015-07-28 21:11:12
阅读次数:
130
开始想用kruskal算法自己写写runtime error
#include
#include
#include
using namespace std;
int a[2510][25100];
struct weight
{
int a,b;
int value;
bool operator < (const weight & rhs) const
{...
分类:
编程语言 时间:
2015-07-28 21:09:04
阅读次数:
145
题目链接:hdu 5291 Candy Distribution
每次先计算出dp[0],然后根据dp[0]的数值可以用o(1)的复杂度算出dp[1],以此类推。总体复杂度为o(200 * 80000),可以接受。
#include
#include
#include
using namespace std;
const int maxn = 80000;
const int maxm...
分类:
其他好文 时间:
2015-07-28 21:06:14
阅读次数:
187
题目链接:hdu 5316 Magician
线段树,区间合并,每个节点维护两端位置分别为奇奇,奇偶,偶奇,偶偶的beautiful 子串,合并的时候注意不能为空即可。
#include
#include
#include
using namespace std;
typedef long long ll;
const int maxn = 100005;
const...
分类:
其他好文 时间:
2015-07-28 21:04:28
阅读次数:
128
多校签到题,dfs一下就好了。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int N = 101; 7 int head[N]; 8 int sum[N]; 9 bool f[N];10 int n, ...
分类:
其他好文 时间:
2015-07-28 20:58:16
阅读次数:
142
最简单的树剖点更新+线段树区间求和 1 #include 2 #include 3 #include 4 using namespace std; 5 #define lson l,m,rtmaxsize) 39 maxsize = siz[e[i].v],s...
分类:
其他好文 时间:
2015-07-28 20:57:55
阅读次数:
85
通道题意:n个数,A后缀和B的前缀相同,建边,问长度为m的有多少个。思路:建图,完了代码: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 typedef long long ll; 8 9 const int MA...
分类:
其他好文 时间:
2015-07-28 20:51:35
阅读次数:
96
最近接触了C#Socket网络编程,试着做了试试(*^__^*)实现多个客户端和服务端互相发送消息发送文件抖动窗口功能 服务端:using System;using System.Collections.Generic;using System.ComponentModel;using Syste....