| ||||||||||
| 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 | |||||||||
不是有很多人用Java过了么=.=RE有时候不是开不出数组的问题……In Reply To:Java 过不了这道题 是不是没有用java -Xmx200m ? Posted by:Larva at 2006-10-24 12:42:59 > 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator