View Code of Problem 108

#include <iostream>
#include <cstdio>
using namespace std;
int main(){
    int a[999],n;
    string m;
    cin>>n;
    while(n--){
        cin>>m;
        a[1]=1,a[2]=2;
        for(int i=3;i<=m.length();i++){
            a[i]=a[i-1]+a[i-2];
        }
        cout<<a[m.length()]<<endl;
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 108