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 过不了这道题 是不是没有用java -Xmx200m ?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