ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

Java help
Posted by Mesh 2 Jul 2008 04:08
Hello, since I'm new to Java, can anyone tell me why is this CE?


import java.math.*;
import java.io.*;
import java.util.*;

public class Main
{
      static final int MAXN = 200;
      static int n, k;
      static BigInteger DP[][] = new BigInteger[ MAXN ][ 2 ];

      public static void main(String args[])
      {
         BufferedReader f = new BufferedReader( new InputStreamReader( System.in ) );
        PrintWriter out = new PrintWriter( System.out );

        StringTokenizer st = new StringTokenizer(f.readLine());

        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());

        DP[ 0 ][ 0 ] = new BigInteger( "" + 1 );
        DP[ 0 ][ 1 ] = new BigInteger( "" + ( k-1 ) );

        for ( int i = 1;  i < n;  i++ )
        {
            DP[ i ][ 0 ] = DP[ i-1 ][ 1 ];
            DP[ i ][ 1 ] = ( DP[ i-1 ][ 1 ].add(DP[ i-1 ][ 0 ]) ).multiply( new BigInteger( "" + ( k-1 ) ) );
        }

        out.println( DP[ n-1 ][ 1 ] );
        out.close();
        System.exit(0);
    }
}

It says:
.\Main.java:17: unreported exception java.io.IOException; must be caught or declared to be thrown
        StringTokenizer st = new StringTokenizer(f.readLine());
                                                           ^
1 error