View Code of Problem 108

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

}

Double click to view unformatted code.


Back to problem 108