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