1091: 童年生活二三事(多实例测试)
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);int []a=new int[45];a[1]=1;a[2]=2;for(int i=3;i<=40;i++) a[i]=a[i-1]+a[i-2];while(cin.hasNext()){
int n=cin.nextInt();if(n==0) break;System.out.println(a[n]);}}
}