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 ;
- }
HDU 5694 BD String 递归暴力的更多相关文章
- HDU 5694——BD String——————【递归求解】
BD String Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total S ...
- HDU 5694 BD String 迭代
BD String 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5694 Description Problem Description 众所周知, ...
- HDU 5311 Hidden String (暴力)
题意:今天是BestCoder一周年纪念日. 比赛管理员Soda有一个长度为n的字符串s. 他想要知道能否找到s的三个互不相交的子串s[l1..r1], s[l2..r2], s[l3..r3]满足下 ...
- hdu-5694 BD String(分治)
题目链接: BD String Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- 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] + ...
- HDU 2920 分块底数优化 暴力
其实和昨天写的那道水题是一样的,注意爆LL $1<=n,k<=1e9$,$\sum\limits_{i=1}^{n}(k \mod i) = nk - \sum\limits_{i=1}^ ...
- BD String
BD String Accepts: 388 Submissions: 1164 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/ ...
- HDU 5311 Hidden String (优美的暴力)
Hidden String Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) ...
- HDU 5944 Fxx and string(暴力/枚举)
传送门 Fxx and string Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Othe ...
随机推荐
- nodejs read/write file
fs.readFile('c:\\tmp\\helloworld.txt','utf8',function(err,data){console.log(data);}) var token=fs.re ...
- drupal CMS
http://drupalchina.cn/ https://www.drupal.org
- struts2拦截器-简单实现非法登录验证
概念:什么是拦截器 拦截器实现了面向切面的组件,它会影响多个业务对象的公共行为封装到一个个可重用的模块,减少了系统的重复代码,实现高度内聚,确保业务对象的整洁! 为什么使用拦截器 拦截器消除了动作 ...
- Extjs4.2——Panel
一.Panel的border属性: 示例: Ext.create('Ext.panel.Panel', { title: 'Hello', width: 200, height:100, border ...
- EasyUI datagrid 分页Json字符串格式
//EasyUI datagrid 分页Json字符串格式 //{"total":xx,"rows":[{...},{...}]} total:总数 rows: ...
- leetcode6 Reverse Words in a String 单词取反
Reverse Words in a String 单词取反 whowhoha@outlook.com Question: Given an input string s, reverse the ...
- unity3d学习笔记(十九)--ngui制作3d人物头顶的头像和血条
原地址:http://blog.csdn.net/lzhq1982/article/details/18793479 本系列文章由Aimar_Johnny编写,欢迎转载,转载请标明出处,谢谢. htt ...
- properties配置文件中文乱码解决方法
方法1 properties文件的格式一般为: ROOT=http://localhost:8080/BNCAR2/ ROOTPATH=E:/ws2/BNCAR2/rel/ MALL_PARTS_ ...
- java 转换 小函数(不断增加中。。。)
//char数组转换成byte数组 private byte[] getBytes (char[] chars) { Charset cs = Charset.forName ("UTF-8 ...
- 已授予账号 "以服务方式登录"的权限
已授予账号.\Cliff "以服务方式登录"的权限 --------------------------------------------------- 进入服务管理器(Serv ...