// BigDecimal是处理double精度问题的对象 BigDecimal b1 = new BigDecimal("10"); BigDecimal b2 = new BigDecimal("10"); // 结果 BigDecimal result = null; // 加 result ...
分类:
其他好文 时间:
2017-06-12 20:35:25
阅读次数:
109
Little X has n distinct integers: p1,?p2,?...,?pn. He wants to divide all of them into two sets A and B. The following two conditions must be satisfie ...
分类:
其他好文 时间:
2017-06-12 16:19:44
阅读次数:
134
´ ´ © © > > µ µ ® ® & & ° ° ¡ ¡ » » ¦ ¦ ÷ ÷ ¿ ¿ ¬ ¬ § § ? • ½ &f ...
分类:
其他好文 时间:
2017-06-11 21:11:08
阅读次数:
193
唔,D:概率最多是 $ \frac{1}{2} $ ,在n==1000的时候这个阈值大概是7284,O(7284n)即可 1 #include <iostream> 2 #include <cstdlib> 3 #include <cstdio> 4 #include <algorithm> 5 # ...
分类:
其他好文 时间:
2017-06-10 18:16:07
阅读次数:
242
归并排序:归并排序是建立在归并操作上的一种有效的排序算法,该算法是採用分治法(Divide and Conquer)的一个很典型的应用。将已有序的子序列合并,得到全然有序的序列。即先使每一个子序列有序,再使子序列段间有序。若将两个有序表合并成一个有序表,称为二路归并。 数据结构的学习过程中。我们常常 ...
分类:
编程语言 时间:
2017-06-07 10:14:47
阅读次数:
187
今天在写一个JAVA程序的时候出现了异常:java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result。发现报错的语句是: 1 foo.divide(ba ...
分类:
编程语言 时间:
2017-06-05 23:44:10
阅读次数:
350
1305 Pairwise Sum and Divide 题目来源: HackerRank 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 有这样一段程序,fun会对整数数组A进行求值,其中Floor表示向下取整: 1305 Pairwise Sum and Div ...
分类:
其他好文 时间:
2017-06-04 22:54:12
阅读次数:
208
Note: It is easier to use divided conquer. As you can see, the question is just to add right to left's last. Here we care more about last then the top ...
分类:
其他好文 时间:
2017-06-02 09:55:54
阅读次数:
228
题目链接 题目大意: 两个人要把一堆宝珠,在不能切割的情况下按照价值平分,他们把宝珠分成6种价值,每种价值的宝珠n个。 n<=200000 思考: 首先如果加和下来的价值是一个偶数 那么还分毛啊,直接gg. 之后多重背包二进制优化 转换为 01背包。 我们可以把价值 同时当做宝珠的空间和价值。 那么 ...
分类:
其他好文 时间:
2017-06-01 21:36:43
阅读次数:
244
说一说归并排序 归并排序:归并排序(英语:Merge sort,或mergesort),是创建在归并操作上的一种有效的排序算法,效率为O(n log n)。1945年由约翰·冯·诺伊曼首次提出。该算法是采用分治法(Divide and Conquer)的一个非常典型的应用,且各层分治递归可以同时进行 ...
分类:
编程语言 时间:
2017-05-29 17:22:32
阅读次数:
157