您的位置:首页 > 编程语言 > Java开发

java BigInteger

2013-10-07 21:59 267 查看
package bookcode;

import java.math.*;
import java.util.*;

public class BigIntegerTest{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
System.out.print("How many numbers do you need to draw?");
int k=sc.nextInt();
System.out.print("What the highest number you can draw?");
int n=sc.nextInt();
BigInteger t= BigInteger.valueOf(1);
for(int i=1;i<=k;i++)
t=t.multiply(BigInteger.valueOf(n-i+1).divide(BigInteger.valueOf(i)));
System.out.println("Your odd are 1 in "+ t +",good luck!");
}
}

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: