View Code of Problem 108

#include <stdio.h>
#include <string.h>
using namespace std;
int main(){
	int arr[50] = {1,2};
	char ch[100];
	for( int i=2; i<50; i++){
		arr[i] = arr[i-1]+ arr[i-2];
	}
	int n;
	scanf("%d", &n);
	getchar();
	for( int i=0; i<n; i++ ){
		scanf("%s", &ch);
		printf("%d\n", arr[strlen(ch)-1]);
	}
	
	return 0;
	
}

Double click to view unformatted code.


Back to problem 108