View Code of Problem 108

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
    int n,l;
    long long int num[60]={0,1,2,};
    char str[60];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%s",str);
        l=strlen(str);
        for(int j=3;j<=l;j++){
            num[j]=num[j-1]+num[j-2];
        }
        printf("%lld\n",num[l]);
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 108