码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
递归算法——求取斐波那契数列(1)
import java.util.Scanner;/** * Created by Administrator on 14-5-13. * 计算斐波那契数列 * * Result M(Problem prob) { if () return ; // The problem cannot be so...
分类:其他好文   时间:2014-07-15 00:39:15    阅读次数:408
均值定义及实例
def Mean(t): """均值""" return float(sum(t)) / len(t)
分类:其他好文   时间:2014-07-15 00:09:49    阅读次数:516
众数定义及示例
def Mode(t): """众数""" if not t: return None arr = __getfreq(t) if arr[0][0] == 1: return None else: for k, g in it...
分类:其他好文   时间:2014-07-15 00:03:24    阅读次数:278
中位数定义及示例
def Median(t): """中位数""" arr = sorted(t) idx = (len(arr) - 1) / 2 if type(idx) is int: return arr[idx] if type(idx) is float: ...
分类:其他好文   时间:2014-07-14 23:49:19    阅读次数:334
极差,方差,标准差
def Var(t, mu=None): """方差""" if mu is None: mu = Mean(t) # compute the squared deviations and return their mean. dev2 = [(x - mu)*...
分类:其他好文   时间:2014-07-14 23:28:48    阅读次数:265
java后台生成zip打包文件
/** * * @param zipFile 压缩包文件对象 * @param listKey 压缩的图片物理地址 * @return */ public static boolean packageZip(File zipFile,List li...
分类:编程语言   时间:2014-07-14 23:21:36    阅读次数:357
分别利用并查集,DFS和BFS方法求联通块的数量
联通块是指给定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
ruby 变量和方法
def say_goodnight(name) result ="Good night ." +name return resultenddef say_goodmorning(name) result ="Good morning .#{name}" return resultendde...
分类:其他好文   时间:2014-07-14 14:14:34    阅读次数:189
Remove Duplicates from Sorted Array
描述 Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in ...
分类:其他好文   时间:2014-07-14 13:46:43    阅读次数:229
微型php框架 library/image.class.php
<?php//验证码类classp_w_picpath{protected$im;protected$img_width;protected$img_height;protected$img_type;//生成随机数staticpublicfunctionrandStr($n=4){if($n<=0){return‘‘;}$str=‘abcdefghijkmnpqrstuvwxyzABCDEFGHIJKMNPQRSTUVWXYZ0123456789‘;$str=substr(st..
分类:Web程序   时间:2014-07-14 12:16:07    阅读次数:287
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!