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

  1. #include <cstdio>
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <cstring>
  5. #include <cmath>
  6. using namespace std;
  7. typedef long long LL;
  8. LL solve(LL x){
  9. if(x<=)return ;
  10. LL cur=,ret=;
  11. while(cur<x){
  12. cur=cur*+;
  13. }
  14. cur=(cur-)/;
  15. ret=(cur+)/;
  16. LL res=x-cur-;
  17. return ret++res-(ret-solve(cur-res));
  18. }
  19. int main(){
  20. int T;
  21. scanf("%d",&T);
  22. while(T--){
  23. LL l,r;
  24. scanf("%I64d%I64d",&l,&r);
  25. printf("%I64d\n",solve(r)-solve(l-));
  26. }
  27. return ;
  28. }

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. nodejs read/write file

    fs.readFile('c:\\tmp\\helloworld.txt','utf8',function(err,data){console.log(data);}) var token=fs.re ...

  2. drupal CMS

    http://drupalchina.cn/ https://www.drupal.org

  3. struts2拦截器-简单实现非法登录验证

    概念:什么是拦截器 拦截器实现了面向切面的组件,它会影响多个业务对象的公共行为封装到一个个可重用的模块,减少了系统的重复代码,实现高度内聚,确保业务对象的整洁!   为什么使用拦截器 拦截器消除了动作 ...

  4. Extjs4.2——Panel

    一.Panel的border属性: 示例: Ext.create('Ext.panel.Panel', { title: 'Hello', width: 200, height:100, border ...

  5. EasyUI datagrid 分页Json字符串格式

    //EasyUI datagrid 分页Json字符串格式 //{"total":xx,"rows":[{...},{...}]} total:总数 rows: ...

  6. leetcode6 Reverse Words in a String 单词取反

    Reverse Words in a String  单词取反 whowhoha@outlook.com Question: Given an input string s, reverse the ...

  7. unity3d学习笔记(十九)--ngui制作3d人物头顶的头像和血条

    原地址:http://blog.csdn.net/lzhq1982/article/details/18793479 本系列文章由Aimar_Johnny编写,欢迎转载,转载请标明出处,谢谢. htt ...

  8. properties配置文件中文乱码解决方法

    方法1   properties文件的格式一般为: ROOT=http://localhost:8080/BNCAR2/ ROOTPATH=E:/ws2/BNCAR2/rel/ MALL_PARTS_ ...

  9. java 转换 小函数(不断增加中。。。)

    //char数组转换成byte数组 private byte[] getBytes (char[] chars) { Charset cs = Charset.forName ("UTF-8 ...

  10. 已授予账号 "以服务方式登录"的权限

    已授予账号.\Cliff "以服务方式登录"的权限 --------------------------------------------------- 进入服务管理器(Serv ...