#include<stdio.h> #include<string.h> #include<math.h> int main(){ int a,b[40]; scanf("%d",&a); b[0]=1; b[1]=2; for(int j=2;j<=40;j++) b[j]=b[j-1]+b[j-2]; for(int i=0;i<a;i++){ int w; scanf("%d",&w); printf("Scenario #%d\n:",i+1); printf("%d\n",b[w]); } } |
Double click to view unformatted code.