View Code of Problem 108

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

int main()
{
	int n;
	char s[55];
	int num[55];
	
	num[1] = 1;
	num[2] = 2;
	for(int i = 3; i <= 50; i++)
		num[i] = num[i-1] + num[i-2];
	
	scanf("%d", &n);
	getchar();
	while(n--)
	{
		int len;
		gets(s);
		len = strlen(s);
		printf("%d\n", num[len]);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 108