View Code of Problem 108

#include<stdio.h>
int panduan(int x){
	int w=0;
	do{
		w++;
		x/=10;
	}while(x>0);
	
	return w;
}
int main(){
	int n,w;
	scanf("%d",&n);

	 //要判断位数 
	int a[100];
	while(n--){
		int x;
		scanf("%x",&x);
		int z=panduan(x);
		
		int a[100]={0,1,2,3,5,8};
		if(z==1){
			printf("1\n");
		}else if(z==2){
			printf("2\n");
		}else if(z>=3){
			for(int i=3;i<=z;i++){
				a[i]=a[i-1]+a[i-2];
				
			}
		printf("%d\n",a[z]);
		
		}
		
	} 
	
	
	return 0;
} 

Double click to view unformatted code.


Back to problem 108