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!"); } }
相关文章推荐
- 编写JavaBean组件
- 利用MyEclipse的ant插件生成Hibernate的映射文件
- 解释Spring中IOC, DI, AOP
- Java逍遥游记读书笔记<三>
- Java的身份证号码工具类
- java 初级试题
- java 中的sychronized的详解
- Java中静态代码块、非静态代码块和构造函数的执行顺序
- LATEX TEMPLATE (SPRINGER) (*.BST)
- LATEX TEMPLATE (SPRINGER) (*.BST)
- java通配符的使用方法
- Java中的深复制与浅复制
- java中集合杂记
- Exception in thread "main" java.lang.StackOverflowError
- Spring AOP 详解
- Eclipse
- java中super和this的用法
- Spring AOP 详解
- Spring AOP 详解
- [原]Spring AOP 详解