View Code of Problem 108

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
    double a[999];
    int n;
//    char m[999];
    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;
        printf("%.f\n",a[m.length()]);
    }
    return 0;
}







Double click to view unformatted code.


Back to problem 108