2009-02-14 13:20:55來源不明

96北市資訊學科能力競賽 會議中心(Room)

/************************************************************/

  1. #include<stdio.h>      
  2. #include<stdlib.h>   
  3. #include<string.h>   
  4. main()   
  5. {   
  6.   int a,b,temp=1,sum=2;   
  7.   int x[100];   
  8.   while(scanf("%d",&a)==1)   
  9.   {   
  10.     x[0]=1;x[1]=1;   
  11.    if(a!=1)   
  12.     {   
  13.      for(b=0;b<a;b++)   
  14.       {   
  15.        x[b+2]=x[b]+x[b+1];   
  16.       }         
  17.       printf("%d\n",x[b]);    
  18.     }   
  19.    else  
  20.     printf("1\n");   
  21.   }       
  22.  return 0;       
  23. }