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

Java 过不了这道题 是不是没有用java -Xmx200m ?

Posted by Larva at 2006-10-24 12:42:59 on Problem 2229
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String line=null;
			line=br.readLine();
			final int MAX = 1000000000;
			int n=Integer.parseInt(line),M[]=new int[n+1];
			M[1]=1;
			M[2]=2;
			for(int i=3;i<=n;i++){
				M[i]=i%2==0?M[i-2]+M[i>>1]:M[i-1];
				M[i]=M[i]>MAX?M[i]%MAX:M[i];
			}
			System.out.println(M[n]);
	}
}



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