HDOJ 4389 X mod f(x)
X mod f(x)
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1403 Accepted Submission(s): 599
int f ( int x ) {
if ( x == 0 ) return 0;
return f ( x / 10 ) + x % 10;
}
Now, you want to know, in a given interval [A, B] (1 <= A <= B <= 109), how many integer x that mod f(x) equal to 0.
Each test case has two integers A, B.
1 10
11 20
Case 2: 3
#include <iostream>
#include <cstdio> #include <cstring> using namespace std; int bit[10],dp[10][82][82][82]; int dfs(int pos,int sum,int mod,int res,bool limit) int calu(int x) int main() |
* This source code was highlighted by YcdoiT. ( style: Codeblocks )
HDOJ 4389 X mod f(x)的更多相关文章
- HDU - 4389 X mod f(x)(数位dp)
http://acm.hdu.edu.cn/showproblem.php?pid=4389 题意 为[A,B] 区间内的数能刚好被其位数和整除的数有多少个. 分析 典型的数位dp...比赛时想不出状 ...
- HDU 4389——X mod f(x)(数位DP)
X mod f(x) Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Probl ...
- hdu 4389 X mod f(x) 数位DP
思路: 每次枚举数字和也就是取模的f(x),这样方便计算. 其他就是基本的数位Dp了. 代码如下: #include<iostream> #include<stdio.h> # ...
- HDU 4389 X mod f(x)
题意:求[A,B]内有多少个数,满足x % f(x) == 0. 解法:数位DP.转化为ans = solve(b) - solve(a - 1).设dp[i][sum][mod][r]表示长度为i, ...
- HDU4389:X mod f(x)(数位DP)
Problem Description Here is a function f(x): int f ( int x ) { if ( x == 0 ) return 0; return f ( x ...
- HDU X mod f(x)(题解注释)
X mod f(x) Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- hdu4389 X mod f(x)
链接 这个题因为总和加起来是比较小的9*9 = 81 这样可以保留前面枚举的数对所有的可能出现的和的余数,然后依次向下找. #include <iostream> #include< ...
- 动态规划 is beginning。。。。。。。。。
感觉动态规划非常模糊,怎么办呢??? 狂刷题吧!! !! ! !!! ! !!! !! ! ! ! .!! ..!.! PKU PPt 动规解题的一般思路 1. 将原问题分解为子问题 ...
- 基础数位DP小结
HDU 3555 Bomb dp[i][0] 表示含 i 位数的方案总和. sp[i][0] 表示对于位数为len 的 num 在区间[ 10^(i-1) , num/(10^(len-i)) ] 内 ...
随机推荐
- 帝国cms搜索表单用法
还有一些没有测试,用到了再补充. <form action="[!--news.url--]e/search/index.php" method="post&quo ...
- 重启电脑后,oracle数据库连接不上
oracle10g安装成功后使用正常,重启电脑后,连接不上了,电脑-服务中各个服务都手动重启了,仍然无效 报错信息:ORA-12514 TNS 监听程序当前无法识别连接描述符中请求服务 要手工去操作命 ...
- Visual Studio原生开发的20条调试技巧(下)
我的上篇文章<Vistual Studio原生开发的10个调试技巧>引发了很多人的兴趣,所以我决定跟大家分享更多的调试技巧.接下来你又能看到一些对于原生应用程序的很有帮助的调试技巧(接着上 ...
- KEGG and Gene Ontology Mapping in Bioinformatic Method
使用KOBAS进行KEGG pathway和Gene Ontology分析 Article from Blog of Alfred-Feng http://blog.sina.com.cn/u/170 ...
- JQuery 和JavaScript的区别
Google提供的jquery包: http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js jQuery官方的jquery包: ...
- UML的目标
http://zhidao.baidu.com/link?url=ghQvzG70vSCSLyQcrHDTd7xt1aSWBR73lPIMxBCEPo1ktkq9cQ3EE9TXX1mZyHINkVA ...
- aircrack-ng test
Aircrack-ng工具包有很多工具,我用到的工具主要有以下几个: airmon-ng 处理网卡工作模式 airodump-ng 抓包 aircrack-ng 破解 aireplay-ng 发包,干 ...
- ajax请求下拉列表框的实现(面向对象封装类)
实现的效果图 <?php class Car{ private $carColor; private $carType; public function __construct($carColo ...
- Java Connection.setAutoCommit
Java setAutoCommit 默认为true,即每条SQL语句在各自的一个事务中执行. 很多时候需要有多个操作在一个事务执行,如循环插入,此时可在插入开始前设置 conn.setAutoCom ...
- 浏览器本地存储(browser-storage,HTML5-localStorage > IE-UserData > Cookie)
https://www.baidufe.com/component/browser-storage/index.html BrowserStorage是浏览器本地存储的一个解决方案,存储优先级依次为: ...