HDU 5694 BD String 递归暴力

http://blog.csdn.net/angon823/article/details/51484906

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long LL;
LL solve(LL x){
if(x<=)return ;
LL cur=,ret=;
while(cur<x){
cur=cur*+;
}
cur=(cur-)/;
ret=(cur+)/;
LL res=x-cur-;
return ret++res-(ret-solve(cur-res));
}
int main(){
int T;
scanf("%d",&T);
while(T--){
LL l,r;
scanf("%I64d%I64d",&l,&r);
printf("%I64d\n",solve(r)-solve(l-));
}
return ;
}
上一篇:sql中order by 待排序的字段值相同时,发生分页出现重复数据的问题


下一篇:SQL的联结