OJ题目:click here~~
题目分析:四塔问题,n个盘,从塔1,到塔4,至少需要多少步。
这里n的范围是( 0 , 50000 ] ,所以不能直接用四塔算法。这里找规律就可以了。
AC_CODE
const int mod = 10000;
const int Max_N = 50002;
int dp[Max_N];
int main()
{
int i , j = ...
分类:
其他好文 时间:
2014-05-07 08:18:09
阅读次数:
226
题目大意:
给出m个询问,问【l,r】之间的和 ,求出有多少次询问不和之前的矛盾的。
思路分析:
用并查集记录当前节点到根节点的和。
#include
#include
#include
#include
#define maxn 222222
using namespace std;
int set[maxn];
int sum[maxn];
in...
分类:
其他好文 时间:
2014-05-07 07:35:05
阅读次数:
386
今天一个女生咨询我报名学优化。聊着聊着就让我优化一个sql,贴给大家看一下
select (case
when grouping(allwo.workshop_code) = 1 then
''
else
nvl(max(allwo.workshop_code), '未维护车间')
end) worksho...
分类:
其他好文 时间:
2014-05-07 06:45:47
阅读次数:
398
[Question]
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to t...
分类:
其他好文 时间:
2014-05-07 05:37:44
阅读次数:
278
递归建树,由题知该树是一棵二叉树,且除根节点外其他点的度为0或2。
dp[i][j]表示来到第i个走廊(还未走过这条走廊)还剩下j时间,能拿到最大的画的数量。
dp[i][j]=max(dp[i][j],dp[lson[i]][k]+dp[rson][last_time-k])
#include
#include
using namespace std;
int dp[200][70...
分类:
其他好文 时间:
2014-05-07 05:02:45
阅读次数:
295
此为C语言的基础,和Linux内核关系并不大,不过还是作为补充知识点介绍一下好了。宏非常频繁的用于执行简单的计算,比如在两个表达式中寻找其中较大的一个:
#define MAX(a,b) ((a)>(b)?(a):(b))
如果使用函数来实现的话就比较慢,宏的话在编译的时候就完成工作,所以使用宏远比使用函数调用效率来的可观。和使用函数相比,使用宏的不利之处就在于每次使用宏的时候,一个宏定义代码...
分类:
其他好文 时间:
2014-05-07 04:59:27
阅读次数:
270
题意:一个A和两个B一共可以组成三种字符串:"ABB","BAB","BBA".
给定若干字母和它们相应的个数,计算一共可以组成多少个不同的字符串.
思路:
(a1+a2+ ... +an)! / a1! / a2! / ... / an! 大数
#include
#include
const int MAX =5...
分类:
其他好文 时间:
2014-05-06 23:05:30
阅读次数:
323
在启动数据库时出现下列错误[oracle@edbjr2p1~]$sqlplus/assysdbaSQL*Plus:Release11.2.0.4.0ProductiononMonMay521:56:002014Copyright(c)1982,2013,Oracle.Allrightsreserved.Connectedtoanidleinstance.SYS@PROD>startupORA-00119:invalidspecificationforsystemparamete..
分类:
数据库 时间:
2014-05-06 17:32:11
阅读次数:
503
NYOJ 640 Geometric Sum...
分类:
其他好文 时间:
2014-05-06 15:20:32
阅读次数:
229
【Question】
Given an array S of n integers, are there elements a, b, c in S such
that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note:
Elements in ...
分类:
其他好文 时间:
2014-05-06 14:57:29
阅读次数:
318