string str="4+4+2.1";要的效果: double sum=4+4+2.1;方案一:动态计算表达式: 1 public class Expression 2 { 3 object instance; 4 MethodInfo method; ...
分类:
其他好文 时间:
2014-07-30 14:42:33
阅读次数:
250
HDU 1166【题意】:n个阵营一字排开,每个初始有a[i]个人。现有两种操作:Q a b 查询[a,b]之间总人数并输出A/S a b 在a号位添加/删除b个人【分析】:最基本的单点更新和区间查询,维护节点信息sum[o]【代码】: 1 #include 2 #include 3 #incl.....
分类:
其他好文 时间:
2014-07-30 11:56:23
阅读次数:
450
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which...
分类:
其他好文 时间:
2014-07-30 11:30:33
阅读次数:
247
很典型的线段树,注意就是一个数字如果变成了斐波那契数字之后如果在change的话,它是不会反生改变的,因为最近的斐波那契数字就是它本身了啊。
用一个flag表示这一段上的数字是否change过,如果flag == 1已经change过,就不会在向下更新。否则的话就进行更新,最后会到达一个节点,更新这个节点。这里用暴力更新就行,找到最近的斐波那契数字。
Add就是一个点更新,sum求和就是一个区...
分类:
其他好文 时间:
2014-07-30 10:07:43
阅读次数:
438
n个点,每个初始值为零,m个操作,共三种操作:
1 k d - "add"
2 l r - "query sum"
3 l r - "change to nearest Fibonacci"
1 ≤ n ≤ 100000, 1 ≤ m ≤ 100000, |d| < 231...
分类:
其他好文 时间:
2014-07-30 10:03:53
阅读次数:
246
题目:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may com....
分类:
编程语言 时间:
2014-07-30 05:35:03
阅读次数:
309
题目: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [?2,1,?3,4,?1...
分类:
编程语言 时间:
2014-07-30 05:34:43
阅读次数:
319
题目:Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all suc....
分类:
编程语言 时间:
2014-07-30 03:19:32
阅读次数:
341
/*
中文题意:
中文翻译:
题目大意:
解题思路:
难点详解:用到一个公式sqrt(a[ i ] * a[ i ]-1 )。他是求边长的,令边长为sum,sum=sqrt(r*r-1)*2,如果不够继续加长方形知道够为止。
关键点:快排,
解题人:lingnichong
解题时间:2014/07/29 21:36
感想:写了很久很久,才写出来,才理解意思是啥
*/
...
分类:
其他好文 时间:
2014-07-30 01:08:22
阅读次数:
223
给一个矩阵,依然是求满足条件的最大子矩阵不过题目中说任意两列可以交换,这是对题目的简化求出h数组以后直接排序,然后找出(col-j)*h[j]的最大值即可(这里的j是从0开始)因为排序会影响到h数组下一行的求解,所以将h数组中的元素复制到temp数组中去,再排序 1 //#define LOCAL ...
分类:
移动开发 时间:
2014-07-30 00:40:22
阅读次数:
232