View Code of Problem 108

#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;
int main(){
    int n;
    cin>>n;
    long int a[50];
    a[1]=1,a[2]=2;
    for(int i=3;i<51;i++){
        a[i]=a[i-1]+a[i-2];
    }
    while(n--){
        char m[999];
        cin>>m;
        cout<<a[strlen(m)]<<endl;
        
    }
    return 0;
}
/*
Main.cc: In function 'int main()':
Main.cc:16:25: error: 'strlen' was not declared in this scope
         cout<<a[strlen(m)]<<endl;
                         ^
*/

Double click to view unformatted code.


Back to problem 108