Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
请教为何会Runtime Exception?或者RE有哪些可能性啊?谢谢 代码如下 import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Scanner; /** * * @author scbit */ public class Main{ /** * @param args the command line arguments */ public static void main(String[] args){ InputStream infile=System.in; int T=0; Scanner sc=new Scanner(infile); T=sc.nextInt(); for(int case_i=1;case_i<=T;case_i++) { long result = 0; N=sc.nextLong(); K=sc.nextLong(); result=(cal(N,K)-cal(N,K-1)+mod)% mod; System.out.printf("%d\n", result); } } static long N,K; static long mod=20100713; static long cal(long N,long K){ if(K<0) return 0; if(K==0) return 1; long r=1; for(long i=0;i<N;i++){ r=r*Math.min(K+1, N-i) % mod; } return r; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator