hdu Buy the Ticket
2014-05-27 20:00
225 查看
import java.math.BigInteger; import java.util.*; public class Main { public static void main(String []args) { Scanner cin=new Scanner(System.in); int n,m,i; int t1=0; while(cin.hasNextBigInteger()) { t1++; m=cin.nextInt(); n=cin.nextInt(); if(m==0&&n==0) break; System.out.println("Test #"+t1+":"); if(n>m) { System.out.println("0"); } else { BigInteger sum=new BigInteger("1"); for(i=m+n; i>=1; i--) { BigInteger c1=new BigInteger(((Integer)i).toString()); sum=sum.multiply(c1); } int c=(m-n+1); BigInteger m2=new BigInteger(((Integer)(m+1)).toString()); BigInteger m1=new BigInteger(((Integer)c).toString()); System.out.println(sum.multiply(m1).divide(m2)); } } } }
View Code
相关文章推荐
- hdu 1133 Buy the Ticket
- hdu 1133 Buy the Ticket
- HDU 1133 Buy the Ticket
- hdu 1133 Buy the Ticket
- HDU 1133 Buy the Ticket
- HDOJ HDU 1133 Buy the Ticket ACM 1133 IN HDU
- hdu 1133 Buy the Ticket
- HDU Buy the Ticket(大数除法乘法要注意)
- HDU-1133-Buy the Ticket
- HDU 1133 Buy the Ticket
- HDU 1133 Buy the Ticket
- HDU 1133 Buy the Ticket 卡特兰数
- Hdu 1133 Buy the ticket <卡特兰数+大数处理>
- buy the ticket hdu 1133
- hdu 1133 Buy the Ticket
- HDU-1133 Buy the Ticket (Catalan数)
- hdu-1133-Buy the Ticket
- HDU 1133 Buy the Ticket(DP)
- hdu 1133 Buy the Ticket
- HDU 1133 Buy the ticket catalan 数