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 ;
}

HDU 5694 BD String 递归暴力的更多相关文章

  1. HDU 5694——BD String——————【递归求解】

    BD String Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total S ...

  2. HDU 5694 BD String 迭代

    BD String 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5694 Description Problem Description 众所周知, ...

  3. HDU 5311 Hidden String (暴力)

    题意:今天是BestCoder一周年纪念日. 比赛管理员Soda有一个长度为n的字符串s. 他想要知道能否找到s的三个互不相交的子串s[l1..r1], s[l2..r2], s[l3..r3]满足下 ...

  4. hdu-5694 BD String(分治)

    题目链接: BD String Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others) ...

  5. HDU 4054 Number String

    HDU 4054 Number String 思路: 状态:dp[i][j]表示以j结尾i的排列 状态转移: 如果s[i - 1]是' I ',那么dp[i][j] = dp[i-1][j-1] + ...

  6. HDU 2920 分块底数优化 暴力

    其实和昨天写的那道水题是一样的,注意爆LL $1<=n,k<=1e9$,$\sum\limits_{i=1}^{n}(k \mod i) = nk - \sum\limits_{i=1}^ ...

  7. BD String

    BD String Accepts: 388 Submissions: 1164 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/ ...

  8. HDU 5311 Hidden String (优美的暴力)

    Hidden String Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) ...

  9. HDU 5944 Fxx and string(暴力/枚举)

    传送门 Fxx and string Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Othe ...

随机推荐

  1. MBProgressHUD ---

    1,MBProgressHUD常用属性和用法Demo - (void)testMBProgressHUD { NSLog(@"test MBProgressHUD "); /* 要 ...

  2. iOS开发(1) WebView和HTML 显示

    iOS 7 已经release了.现在学习iOS开发还是非常热门的.到处也有些团队在寻找iOS开发的人才. 那么,iOS开发.....省略了1万字.... HTML5 +CSS3+JS...再省略1万 ...

  3. JS日期格式化(网上转载)

    JS日期格式化(网上转载) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <ht ...

  4. linux命令useradd添加用户详解

    1.作用 useradd或adduser命令用来建立用户帐号和创建用户的起始目录,使用权限是超级用户. 2.格式 useradd [-d home] [-s shell] [-c comment] [ ...

  5. uva 10404

    dp   1表示先手赢 #include <iostream> #include <cstdio> #include <cstring> #include < ...

  6. nagios plugins之 check_http

    nagios下的check_http ZT具体参数是一个比较重要的点,我带大家来看看.. //显示版本 #./check_http -V check_http v2053 (nagios-plugin ...

  7. fork产生子进程利用pipe管道通信

    http://siqun.blog.163.com/blog/static/213496001201341231121720/ 转载链接:http://hi.baidu.com/hj11yc/item ...

  8. Silverlight之Styles和Behaviors

    本文简介 1.定义简单的Style 2.应用Style到元素 3.动态加载Style资源文件 4.Style的继承 5.组织内编写Style(在元素内) 6.自动应用Style到指定类型元素 7.St ...

  9. std::remove

    #include <algorithm> template< class ForwardIt, class T > ForwardIt remove( ForwardIt fi ...

  10. 垃圾收集器GC的种类

    堆内存的结构: