题目链接:请戳这里。 题目大意及思路:读懂题意就好了,就是DFS找联通块。
没什么好说的,见代码吧。
#include
#include
#include
#define N 100+5
using namespace std;
int n,m;
char g[N][N];
int dir[4][2]={1,0,0,1,-1,0,0,-1};
void dfs(int x,int y)
...
分类:
移动开发 时间:
2015-01-21 22:38:05
阅读次数:
352
题目:
Lake Counting
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 21515
Accepted: 10831
Description
Due to recent rains, water has pooled in various...
分类:
其他好文 时间:
2015-01-20 18:02:17
阅读次数:
168
题意是说在1,2,3,……,n的序列中选出前n个数。
能够组成多少种三角形。白书上的例题。
找到递归公式就好了。根据三角不等式,如果三条边为 a,b,c。最大边为c。
a+b>c。
假设a:1 -> c-1 为止,那么a=1无解,a=2有一个,a=3……,a=c-1 有c-2个解。
那么根据等差求和公式得出和。但是需要减去 a==b 的时候,从x/2+1 到 x-1 一共...
分类:
其他好文 时间:
2015-01-20 12:06:39
阅读次数:
174
题目大意是:给定一个n,k,表示树上共有n个节点,每个节点最多有k个叶子,问一共多少种摆法,答案对1000000007取模这里定义一个dp[i]表示 i 个节点对应有多少种方法f[i][j] 表示一个除去顶点的树中,这个顶点延伸出 j 个子树 , 这j个子树中共有i 个点那么只要在f[i][j]上添...
分类:
其他好文 时间:
2015-01-19 14:23:10
阅读次数:
161
http://numbbbbb.gitbooks.io/-the-swift-programming-language-/content/chapter2/16_Automatic_Reference_Counting.html本页包含内容:自动引用计数的工作机制自动引用计数实践类实例之间的循环强引...
分类:
其他好文 时间:
2015-01-18 22:24:43
阅读次数:
248
Digit CountingTime Limit: 3000MSMemory Limit: Unknown64bit IO Format: %lld & %llu Submit Status DescriptionTrung is bored with his mathematics homewor...
分类:
其他好文 时间:
2015-01-18 21:04:17
阅读次数:
219
B - Counting BST Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluSubmit Status Practice UVALive 5058DescriptionBinary Search Tree (BST) ...
分类:
其他好文 时间:
2015-01-18 11:46:37
阅读次数:
161
12075 - Counting TrianglesTriangles are polygons with three sides and strictly positive area. Lattice triangles are the triangles all whose vertexes h...
分类:
其他好文 时间:
2015-01-15 23:33:17
阅读次数:
159
题目:数星星,给你一个二维的矩阵,数里面的单个'*'的个数(周围8个方向不能有'*')。
分析:图论,搜索,floodfill。直接统计面积位移的区域个数即可。
说明:太长时间没刷题了╮(╯▽╰)╭。
#include
#include
#include
using namespace std;
char sky[101][101];
int dxy[8][2] = {1,-1,...
分类:
其他好文 时间:
2015-01-13 21:37:08
阅读次数:
313
Auto packing the repository for optimum performance. You may alsorun "git gc" manually. See "git help gc" for more information.Counting objects: 9231,...
分类:
其他好文 时间:
2015-01-10 16:21:28
阅读次数:
1394