Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

请教为何会Runtime Exception?

Posted by superlukia at 2010-05-09 17:20:10 on Problem 3761
或者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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator