View Code of Problem 108

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main() {
	int n;
	scanf("%d",&n);
	
	while(n--){
		char a[1000];
		scanf("%s",&a);
		int l=strlen(a),i;
		long int b[1000]={0,1,2};
		for(i=3;i<=l;i++){
			b[i]=b[i-1]+b[i-2];
		}
		printf("%ld\n",b[l]);
	}
}

Double click to view unformatted code.


Back to problem 108