View Code of Problem 108

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
    int n;
    cin>>n;
    while(n--){
        double a[999];
        char b[999];
        cin>>b;
        a[1]=1,a[2]=2;
        for(int i=3;i<=strlen(b);i++){
            a[i]=a[i-1]+a[i-2];
        }
//        cout<<a[strlen(b)]<<endl;
        printf("%.f\n",a[strlen(b)]);
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 108