#include#includeconst int MAX=510;using namespace std;int n,m,le=0; //节点数,非叶子节点数,最深层叶层数vector child[MAX]; //存储孩子情况int number[MAX]; //...
分类:
其他好文 时间:
2015-03-10 16:49:01
阅读次数:
149
题目:一个01构成的图,求1的最大联通个数(相邻八个方向)。
分析:图论、搜索、floodfill。求解所有区域取最大即可。
说明:注意输出格式╮(╯▽╰)╭。
#include
#include
#include
using namespace std;
char maps[30][30],buf[30];
int dxy[8][2] = {1,-1,1,0,1,1,0,-1,...
分类:
其他好文 时间:
2015-03-10 00:11:24
阅读次数:
237
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.InputEach input file contains ...
分类:
其他好文 时间:
2015-03-08 01:25:46
阅读次数:
163
第二章
Big O notation 进阶课程
在这一章中,我们将会了解到算法的基础----Counting primitive operation,什么是primitive operation:
The following are all primitive operations:
1. Assigning a value to a variable
2. Calling ano...
分类:
其他好文 时间:
2015-03-07 15:48:27
阅读次数:
154
As most of the ACMers, wy's next target is algorithms, too. wy is clever, so he can learn most of the algorithms quickly. After a short time, he has l...
分类:
编程语言 时间:
2015-03-07 11:26:39
阅读次数:
195
题目大意:数三角形。。数据范围是一百万,而且暴力不可行,所以要推公式。公式可以参照http://www.docin.com/p-720073077.html#includeint t; long long n,m,ans;int main(){ scanf("%d",&t); while...
分类:
其他好文 时间:
2015-03-06 22:00:24
阅读次数:
153
题意:统计[a, b]或[b, a]中0~9这些数字各出现多少次。分析:这道题可以和UVa 11361比较来看。同样是利用这样一个“模板”,进行区间的分块,加速运算。因为这里没有前导0,所以分块的时候要多分几种情况。以2345为例,这是一个四位数,首先要计算一下所有的一位数、两位数以及三位数各个数字...
分类:
其他好文 时间:
2015-03-06 18:56:06
阅读次数:
108
题意:N个点形成一棵树。给出根结点P还有树结构的信息。输出每个点的F[i]。F[i]:以i为根的所有子结点中编号比i小的数的个数。0 G[N];int C[N];int ans[N];stack S;bool vis[N];void Add(int x){ for(int i=x;i0;i-=...
分类:
编程语言 时间:
2015-03-06 14:00:35
阅读次数:
139
nyoj 982Triangle Counting
时间限制:1000 ms | 内存限制:65535 KB
难度:3
描述
You are given n rods of length 1, 2…, n. You have to pick any 3 of them and build a triangle. How many distinct triangles can you make? Note that, two triangles will be considered different i...
分类:
其他好文 时间:
2015-03-05 16:56:54
阅读次数:
222
HDU 3518 Boring counting(后缀数组啊 求字符串中不重叠的重复出现至少两次的子串的个数)...
分类:
编程语言 时间:
2015-03-03 22:14:34
阅读次数:
274