Math对象:Math.PI——代表圆周率这个“常数”方法:Math.max(数值1,数值2,…..) ——求得若干个数值中的最大值。Math.min(数值1,数值2,…..) ——求得若干个数值中的最小值。Math.abs( 数值1) ——求得数值1的绝对值Math.pow( x,y) ——求得....
C/C++如何产生随机数:这里要用到的是rand()函数, srand()函数,C语言/C++里没有自带的random(int number)函数。(1) 假设你仅仅要产生随机数而不须要设定范围的话,你仅仅要用rand()就能够了:rand()会返回一随机数值, 范围在0至RAND_MAX 间。RA...
分类:
编程语言 时间:
2014-07-14 09:06:45
阅读次数:
223
题目链接:http://poj.org/problem?id=1528题目大意:输入一个数n,然后求出约数的和sum,在与这一个数n进行比较,如果sum>n,则输出ABUNDANT,如果sum=n,则输出PERFECT,否则,输出DEFICIENT!注意1的结果是DEFICIENT,0的结果是END...
分类:
其他好文 时间:
2014-07-14 08:59:30
阅读次数:
167
1.枚举法(超时) 1 public class Solution { 2 public int largestRectangleArea(int[] height) { 3 int max=-1; 4 for(int i=0;i=0&&height[k] s...
分类:
其他好文 时间:
2014-07-14 08:22:17
阅读次数:
373
多重背包问题。
我的背包训练第三题,多重背包。似乎有点理解多重背包了。
我对背包九讲多重背包的理解:
当某件物品 体积*数量 超过背包的容积的时候,这就做完全背包(相当于无限取)
void completepack(int h,int cost,int a)
{
for(int i=cost;i<=a;i++)
dp[i]=max(d...
分类:
其他好文 时间:
2014-07-13 00:09:57
阅读次数:
192
一、问题
在安装opencms是会出现如下错误:
MySQL system variable 'max_allowed_packet' is set to 1048576 Byte (1MB).
Please note that it will not be possible for OpenCms to handle files bigger than this value in ...
分类:
其他好文 时间:
2014-07-12 22:58:44
阅读次数:
353
1.背景 无监督学习的定义就不多说了,不懂得可以google。因为项目需要,需要进行无监督的分类学习。 K-means里面的K指的是将数据分成的份数,基本上用的就是算距离的方法。 大致的思路就是给定一个矩阵,假设K的值是2,也就是分成两个部分,那么我们首先确定两个质心。一开始是找矩阵每一列的最大值max,最小值min,算出range=max-min,然后设...
分类:
编程语言 时间:
2014-07-12 20:04:16
阅读次数:
338
Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
public class Solution {
public String addBinary(String a, String b) {
...
分类:
其他好文 时间:
2014-07-12 19:42:26
阅读次数:
168
#nginx conf by linux kernel
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_tw_recycle=1
net_ipv4.tcp_tw_reuse=1
net_ipv4.tcp_syncookies=1
net.core.soma...
分类:
系统相关 时间:
2014-07-12 18:04:24
阅读次数:
212
Problem Description
A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime...
分类:
其他好文 时间:
2014-07-12 16:42:15
阅读次数:
271