码迷,mamicode.com
首页 >  
搜索关键字:ugly number    ( 27156个结果
POJ-2104-K-th Number(函数式线段树)
Description You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able...
分类:其他好文   时间:2014-07-28 16:14:11    阅读次数:257
利用String.format()使数字最前端自动补零
//在数字最前端加零,自动补齐5位数 int number=9527; String numberString = String.format("%05d", number); System.out.println("numberString="+numberString);...
分类:其他好文   时间:2014-07-28 16:05:53    阅读次数:246
POJ 2104 K-th Number
静态区间第K大,主席树写法。 主席树第一题,如果对整段区间建线段树可以求1~n范围内的第K大,要想求任意区间内的第K大需要建1~i 的n棵线段树。求某一段的时候区间相减就可以了。但是这样空间消耗太大所以要尽量利用以前的节点。注意到1~i的线段树和i~i+1的线段树只某一条链上的值不同,所以我们只要建出这一条链就可以了,剩下的节点和1~i+1的线段树是一样的,我们直接把节点指过去。 T[ ......
分类:其他好文   时间:2014-07-28 15:56:43    阅读次数:270
HDU1158:Employment Planning(DP)
Problem Description A project manager wants to determine the number of the workers needed in every month. He does know the minimal number of the workers needed in each month. When he hires or fires...
分类:其他好文   时间:2014-07-28 15:44:23    阅读次数:284
This 关键字和变量作用域
public class Number { int count; public void method01(){ // int count=3; count=3; // this.count=3; System.out.println(count); } public static void mai...
分类:其他好文   时间:2014-07-28 15:25:23    阅读次数:230
Oracle 归档日志
Oracle可以将联机日志文件保存到多个不同的位置,将联机日志转换为归档日志的过程称之为归档。相应的日志被称为归档日志。一、归档日志是联机重做日志组文件的一个副本包含redo记录以及一个唯一的log sequence number对日志组中的一个日志文件进行归档,如果该组其中一个损坏,则另一个可用的...
分类:数据库   时间:2014-07-28 14:56:33    阅读次数:320
POJ 1019 Number Sequence 题解
这又是一道看似简单,实际挺困难的题目。 本来想做道基础题消遣一下的,没想到反被消遣了-_-|||。 看个人的基础吧,对于数学好的会简单点,但是由于情况太多,需要都考虑全,故此难度应该在4星以上了。 我这里使用的方法就是直接打表,然后直接模拟,利用打表去掉一大段数据,剩下数据量十分小了,故此可以直接模拟。 打表是为了计算前面的周期数,把周期数直接去掉。 主要难点是后面10位数以上的...
分类:其他好文   时间:2014-07-28 00:02:09    阅读次数:273
LeetCode: Max Points on a Line
LeetCode: Max Points on a LineGiven n points on a 2D plane, find the maximum number of points that lie on the same straight line.地址:https://oj.leetcod...
分类:其他好文   时间:2014-07-27 23:22:59    阅读次数:289
HDU - 1711 Number Sequence
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1711 改进的模式匹配算法--KMP算法,时间复杂度有O(n*m)降到O(n+m),求解next数组之后与常规的模式匹配算法相同。 1 #include 2 const int maxn=100...
分类:其他好文   时间:2014-07-27 23:11:29    阅读次数:221
找出数组中出现次数超过一半的元素
题目:找出数组中出现次数超过一半的元素解法:每次删除数组中两个不同的元素,删除后,要查找的那个元素的个数仍然超过删除后的元素总数的一半#include int half_number(int a[], int n){ if( a == NULL || n void find(int a[], ...
分类:其他好文   时间:2014-07-27 23:09:29    阅读次数:169
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!