View Code of Problem 108

#include <bits/stdc++.h>
using namespace std;
long long a[51];
string s;
int n;
int main()
{
	a[0]=1;
	a[1]=1;
	for(int i=2;i<51;i++) 
		a[i] = a[i-1]+a[i-2];
	
	cin>>n;
	while(n--) {
		cin>>s;
		cout<<a[s.size()]<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 108