- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class Ch02 {
- BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
- Ch02() throws Exception, Exception
- {
- long x[]=new long[90],input;
- input=Integer.parseInt(br.readLine());
- x[0]=0;
- x[1]=1;
- for(int i=2; i<x.length; i++)
- x[i]=x[i-1]+x[i-2];
- System.out.println(x[(int) input]);
- }
- public static void main(String[] args) throws Exception {
- long start=System.currentTimeMillis();
- new Ch02();
- System.out.println(System.currentTimeMillis()-start+"ms");
- }
- }
複製代碼 |