View Code of Problem 108

#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<algorithm>

using namespace std;

int fun(int t)
{
    if(t==1)
        return 1;
    if(t==2)
        return 2;
    return fun(t-1)+fun(t-2);
}
int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        string str;
        cin>>str;
        int t=str.size();
        cout<<fun(t)<<endl;
    }
}

Double click to view unformatted code.


Back to problem 108