def Mean(t): """均值""" return float(sum(t)) / len(t)
分类:
其他好文 时间:
2014-07-15 00:09:49
阅读次数:
516
WPF产生不重复的随机数在给定的区间范围(比如[50,99]),产生给定数量的随机数(不如10个),要求产生的随机数不重复首先给定变量min=50;max=99+1;//习惯与程序规定的编码不同所致n=10;好了,上代码1.xaml界面格式 ...
分类:
其他好文 时间:
2014-07-14 22:27:23
阅读次数:
355
联通块是指给定n个点,输入a,b(1#includeusing namespace std;const int maxn=1010;int p[maxn];//作为每个独立的点 int sum[maxn];//每个节点下面连接的点 int find(int x) {if(x==p[x])return...
分类:
移动开发 时间:
2014-07-14 22:21:30
阅读次数:
403
4SumGiven an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum...
分类:
其他好文 时间:
2014-07-14 15:02:09
阅读次数:
228
本文载自【k sum problem】以及【NSum】有位同僚,对该问题做出了代码的小结,想看吗?戳我戳我。问题陈述:在一个数组,从中找出k个数(每个数不能重复取。数组中同一个值有多个,可以取多个),使得和为零。找出所有这样的组合,要求没有重复项(只要值不同即可,不要求在原数组中的index不同)解...
分类:
其他好文 时间:
2014-07-14 14:16:00
阅读次数:
219
我们可以通过在java程序中模拟浏览器一样,把数据抓下来,具体方法是在java程序中set header和cookie,下面是一个例子:
public class NetConnection {
public static final int MAX_HOTWORDS_FILE_SIZE = 256 * 1024;
public static void main(String[] args...
分类:
编程语言 时间:
2014-07-14 13:34:03
阅读次数:
219
最近再写一个网络仿真器,里面参考了Max-MinFairness算法,这是一种比较理想、公平的带宽分配算法。其思路主要如下:首先是算法的准备,考察某一时刻的网络中所有的flow,由于每条flow都有其各个link,因此可以得到各个link上所有流经的flow,然后开始迭代,各个link都把capacity平均分给所有流经的flow,接着每条flow的速度就等于其最小link分配的带宽,然后每条li...
分类:
其他好文 时间:
2014-07-14 13:14:33
阅读次数:
160
点击打开链接
题意:有n条村落连接线路,给你m个草儿附近的村落,在给出t个草儿想去的地方。从草儿附近的村落出发到她想去的地方所有线路中的花费时间最少的一个。
解析:多源多点最短路,暴力枚举
#include
#include
#include
using namespace std;
const int maxn = 1005;
const int Max = 0xfffffff;
i...
分类:
其他好文 时间:
2014-07-14 12:57:00
阅读次数:
214
1、进入information_schema数据库(存放了其他的数据库的信息)useinformation_schema;2、查询所有数据的大小:SELECTconcat(round(sum(DATA_LENGTH/1024/1024),2),’MB’)asdataFROMTABLES;3、查看指定数据库的大小:比如查看数据库hellodb的大小SELECTconcat(round(sum(DATA_..
分类:
数据库 时间:
2014-07-14 11:39:30
阅读次数:
253
Combination Sum IIGiven a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sum...
分类:
其他好文 时间:
2014-07-14 10:42:22
阅读次数:
192