View Code of Problem 108

#include<stdio.h>
#include<math.h>
#include<string.h>

int main(void) {
	int t;
	scanf("%d",&t);
	getchar();
	int i,j;
	for(i=0; i<t; i++) {
		char str[100];
		long long int num[51];
		num[1]=1;
		num[2]=2;
		gets(str);
		for(j=3; j<=strlen(str); j++) {
			num[j]=num[j-1]+num[j-2];
		}
		printf("%lld\n",num[strlen(str)]);

	}
}

Double click to view unformatted code.


Back to problem 108