下沙的沙子有几粒?
1 import java.util.*; 2 import java.math.*; 3 public class Main 4 { 5 public static void main(String []args) 6 { 7 Scanner cin=new Scanner(System.in); 8 int i,n,m; 9 int count=1; 10 while(cin.hasNext()) 11 { 12 m=cin.nextInt(); 13 n=cin.nextInt(); 14 BigInteger s1 = BigInteger.valueOf(1); 15 BigInteger s2 = BigInteger.valueOf(1); 16 BigInteger s3 = BigInteger.valueOf(1); 17 for(i=1;i<=n+m;i++) 18 { 19 s1=s1.multiply(BigInteger.valueOf(i)); 20 } 21 for(i=1;i<=n;i++) 22 { 23 s2=s2.multiply(BigInteger.valueOf(i)); 24 } 25 for(i=1;i<=m;i++) 26 { 27 s3=s3.multiply(BigInteger.valueOf(i)); 28 } 29 s2=s2.multiply(s3); 30 s1=s1.multiply(BigInteger.valueOf(m+1-n)); 31 s1=s1.divide(BigInteger.valueOf(m+1)); 32 System.out.println(s1.divide(s2)); 33 } 34 } 35 }
这个题目和