自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(6)
  • 收藏
  • 关注

原创 Python 组合数

编写程序,计算组合数 C(n,i) ,即从 n 个元素中任选 i 个,有多少种选法?def facto(x): if x==0: return 1 elif x==1: return 1 else: return x*facto(x-1)def comb(n,i): return(facto(n)/facto(i)/facto(n-i)) p...

2018-08-21 10:33:47 6285

原创 Python 鸡兔同笼问题

假设共有鸡、兔30只,脚90只,求鸡、兔各有多少只?for chicken in range(0,30): rabbit=30-chicken chickLeg=2*chicken rabLeg=4*rabbit if(chickLeg+rabLeg==90): print("鸡{0} 兔{1}".format(str(chicken),st...

2018-08-20 17:37:17 15836 1

原创 Python 输出10个不重复的随机数_范围10-100

import randomh =set()while(len(h)<10): h.add(random.randint(10,100))print(h) 

2018-08-20 16:43:00 27237 1

原创 Python 斐波那契数列,光用for循环

prev=1current=1print(current)for i in range(1,12): print(current) next=prev+current prev = current current=next结果如下:1123581321345589144

2018-08-15 10:47:15 11906

原创 Python 简单九九乘法表

i = 1while (i < 10): j = 1 while (j <= i): print(i, "*", j, "=", i * j, end="\t") j += 1 i += 1 print(" ")结果如下:1 * 1 = 1     2 * 1 = 2    2 * 2 = 4     3 ...

2018-08-15 10:24:48 1176

原创 折半查找 Java

// Java implementation of recursive Binary Search class BinarySearch {     // Returns index of x if it is present in arr[l..     // r], else return -1     int binarySearch(int ...

2018-07-24 07:32:18 289

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除