K -QuadtreesTime Limit:3000MSMemory Limit:0KB64bit
IO Format:%lld & %lluSubmitStatusAppoint description:DescriptionQuadtreesA
quadtree is a represent....
分类:
其他好文 时间:
2014-06-12 23:57:11
阅读次数:
509
非常巧妙的题目,巧用cmp,注意cmp的重载
#include
#include
using namespace std;
string a[55];
bool cmp(string a, string b){
return a+b > b+a;
}
int main(int argc, char const *argv[])
{
int n;
while(cin >...
分类:
其他好文 时间:
2014-06-11 06:10:28
阅读次数:
293
最小生成树: 一个连通图的生成树是一个极小连通子图,它含有图中全部顶点,但只有足以构成一棵树的n-1条边。这种构造连通网的最小代价生成树称为最小生成树,详见数据结构之图(术语、存储结构、遍历)。
求连通网的最小生成树有两种经典方法:普里姆(Prime)算法和克鲁斯卡尔(Kruskal)算法。
1、Prime算法
(1)算法描述:假设N=(V,{E})是连通网,TE是N上最小生成树中边的集合。从V中任选一个顶点u0,算法从U={u0}(u0∈V),TE={}开始,重复执行以下步骤:
在所有u∈U、v∈V-U...
分类:
其他好文 时间:
2014-06-10 15:38:52
阅读次数:
211
Description
Problem A
The Most Distant State
Input: standard input
Output: standard output
The 8-puzzle is a square tray in which eight square tiles are placed. The remaining ninth square ...
分类:
其他好文 时间:
2014-06-10 07:59:06
阅读次数:
335
Two players, S and T, are playing a game where they make alternate moves. S plays
first.
In this game, they start with an integer N. In each move, a player removes one digit from the integer and p...
分类:
其他好文 时间:
2014-06-10 06:31:29
阅读次数:
302
挺直接的一个题 哎 想复杂了题意:把n*m矩阵中的字母最小生成树求它的边权值之和 只有字母可以分叉
多了一个提取点的过程思路:prime 算法的简单应用#include#include#includeusing namespace std;char
map[55][55];int node[55][...
分类:
其他好文 时间:
2014-06-09 21:29:26
阅读次数:
276
题目:国际象棋,判断当前状态,哪一方被将军了。不会有同时被将军的情况。
分析:模拟。直接按照国际象棋的规则模拟即可。
把操作分成两种,单点判断和射线判断,写成函数减少公共代码,也降低错误率;
然后:兵、马、王(不用判断)都是单点判断,后、车、象都是射线判断。
每种情况,调用不同的方向向量即可。
说明:没有同时成立的情...
分类:
其他好文 时间:
2014-06-08 17:14:06
阅读次数:
265
题目来源:Light OJ 1278 Sum of Consecutive Integers
题意:N拆分成连续整数和的方案数
思路:奇因数的个数
#include
#include
#include
#include
using namespace std;
//筛素数
const int maxn = 10000010;
bool vis[maxn];
int prime[10...
分类:
其他好文 时间:
2014-06-08 15:34:09
阅读次数:
295
Project Ruler 算法练习之 Truncate Prime...
分类:
其他好文 时间:
2014-06-08 10:06:41
阅读次数:
174
Rotating Sentences
In ``Rotating Sentences,'' you are asked to rotate a series of input sentences 90 degrees clockwise. So instead of displaying the input sentences from left to right and top to b...
分类:
其他好文 时间:
2014-06-08 04:51:34
阅读次数:
236