链接:点击打开链接
题意:问区间[a,b]中有多少斐波那契数
代码:
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
#define N 10000
#define M 300
char str[N][M];
int cmp(char *a,char *b){
int len1,len2;
len1=strlen(a);
len2=strlen(b);
if(len1>len2)
return 1;
if(len1<len2)
return -1;
if(len1==len2){
if(strcmp(a,b)==0)
return 0;
else if(strcmp(a,b)>0)
return 1;
else if(strcmp(a,b)<0)
return -1;
}
} //由于斐波那契不是依照字符顺序排序,因此自写一个cmp函数
void overthrow(char *s){
int i,j;
i=M-1;
while(s[i]=='0')
i--;
s[i+1]='