__author__ = 'dell' import Pmf import matplotlib.pyplot as pyplot pmf = Pmf.MakePmfFromList([1, 2, 2, 3, 5]) print 'Mean by Pmf ', pmf.Mean() print 'Var by Pmf ', pmf.Var() def PmfMean(pmf): t = [x * v for x, v in pmf.Items()] res = sum(t) return res
<span style="color:#FF0000;">第一步:把输入的数字转为字符串n.ToString() 第二步:求出字符串的长度即为正整数的位数 第三步:从后向前逆序输出</span> 附代码: using System; using System.Collections.Generic; using System.Linq; using System.Text; //给一个正整数, //要求:一.求它是几位数,二.逆序打印出各位数字. namespa
题目:我年龄的立方是个4位数.我年龄的4次方是个6位数.这10个数字正好包含了从0到9这10个数字,每个都恰好出现1次,求出我今年几岁. 直接拷贝运行就可以了. public class Age { public static void main(String[] args) { // TODO Auto-generated method stub Age a = new Age(); a.fun(); } private int fun(){ for(int i = 0;i<60;i++){
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? 译文: 观察第一组质数可知,第6位质数为13,那么第10001位质数是多少呢? ============================ 第一次code: import java.util.ArrayList; import j
首先得求出能整除A的数,再判断I是否是质数!!! import java.util.*; public class aa { public static void main(String[] args) { System.out.println("Please input the number:"); Scanner in=new Scanner(System.in); int a; a=in.nextInt(); if(a==1||a==0) System.out.println(&