因为瞬间伤害的塔一定是放在终点端的,所以枚举这种塔的个数
然后就能把n^3变成n^2了
#include
#include
#include
typedef long long ll;
const int N = 1500 + 2;
ll d[N][N]; // j = 3;
int Tt = 0, n, x, y, z, t;
inline void up(ll& a, ll...
分类:
其他好文 时间:
2014-08-12 19:08:14
阅读次数:
279
Problem Description
Mery has a beautiful necklace. The necklace is made up of N magic balls. Each ball has a beautiful value. The balls with the same beautiful value look the same, so if two or more ...
分类:
其他好文 时间:
2014-08-12 17:29:44
阅读次数:
253
题意:有两堆牌s1,s2,牌数都为c,将s2,s1按给定规则相互交叉组成一堆牌s12,
再将s12最底下的c块给s1,最顶端的c块给s2,依此循环下去,
现在输入s1和s2的初始状态 以及 预想的最终状态s12,
问s1 s2经过多少次洗牌之后,最终能达到状态s12,若永远不可能相同,则输出"-1"。
分析:直接简单模拟此规则就行,关键是如何判断是否永远不可能达到预想的s12,
若s1和s2在洗牌后的状态,是前面洗牌时已经出现过的一个状态,且这个状态不是预想的状态S12,
就说明无论怎样再洗牌都不可能达到S...
分类:
其他好文 时间:
2014-08-12 17:17:24
阅读次数:
249
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i...
分类:
其他好文 时间:
2014-08-12 16:40:14
阅读次数:
157
http://acm.hdu.edu.cn/showproblem.php?pid=1505题意:R为被占位置,F为空位,求出最大子空矩阵大小*3.思路:1、悬线法,记录每个位置的悬线能到达的左边和右边最远位置。然后维护面积最大值。每个点计算一次。这是我第一个扫描法的题,从上由下扫描,up[i][j...
分类:
其他好文 时间:
2014-08-12 16:07:34
阅读次数:
172
Beat 'Em Up Game Starter Kit (横版格斗游戏) cocos2d-x游戏源码出售...
分类:
其他好文 时间:
2014-08-12 00:42:33
阅读次数:
268
bnu36907 Subpalindromes
字符串hash+线段树
题意:给一个字符串(
1)将指定位置的字符改为c
2)询问l-r的子串,是否是回文串。
解法 :区间维护pl和pr,表示从左到右的hash和从右到左的hash,然后在up和query中合并区间,最后判断pl和pr是否相等即可。
#include
#include
#include
#include
#inc...
分类:
其他好文 时间:
2014-08-11 21:29:52
阅读次数:
301
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?思路...
分类:
其他好文 时间:
2014-08-11 20:48:22
阅读次数:
220
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?思路:使用两个指针slow和fast,分别以1和2的速度遍历链表。若链表中存在环,则...
分类:
其他好文 时间:
2014-08-11 20:45:12
阅读次数:
230
无情的一题!!!
读了半小时题,才把题目看懂,发现是LIS后写了二分的那种方法,node[i]向ans[i]赋值的时候len++了两次,样例跑不出来,从机房走出去看见一只小猫,回来就发现了bug
=。=
结果一提交,RE,检查发现n最大10000我开的22222,没开小,百度里面看到有人也用这个方法提交后也是RE。。。自己出了几组数据后发现貌似不能用二分写呢(至少我还没想到该怎么改,看到后知...
分类:
其他好文 时间:
2014-08-11 18:07:02
阅读次数:
217