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)) ] 内 ...
随机推荐
- <转>iOS9 Day-by-Day:iOS开发者必须了解的iOS 9新技术与API
iOS9 Day-by-Day是作者Chris Grant新开的一个系列博客,覆盖了iOS开发者必须知道的关于iOS 9的新技术与API,并且还进行了实际操作演练,每篇文章中相关的代码Chris都会将 ...
- AngularJs ngCloak、ngController、ngInit、ngModel
ngCloak ngCloak指令是为了防止Angular应用在启动加载的时候html模板将会被短暂性的展示.这个指令可以用来避免由HTML模板显示造成不良的闪烁效果. 格式: ng-cloak ...
- HDU 1425 sort(堆排序/快排/最大堆/最小堆)
传送门 Description 给你n个整数,请按从大到小的顺序输出其中前m大的数. Input 每组测试数据有两行,第一行有两个数n,m(0<n,m<1000000),第二行包含n个各不 ...
- .bash_profile for mac‘ envionment variables
A typical install of OS X won't create a .bash_profile for you. When you want to run functions from ...
- JS-流程控制汇集
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>流 ...
- IP地址、子网掩码、网关、DNS的关系
什么是IP地址所谓IP地址就是给每个连接在Internet上的主机分配的一个32bit地址.按照TCP/IP协议规定,IP地址用二进制来表示,每个IP地址长32bit,比特换算成字节,就是4个字节 ...
- BZOJ4620: [Wf2016]What Really Happened on Mars?
题意比较难懂?反正我为此特地查了优先级倒置和优先级置顶协议是什么. 读懂题以后就好办了,直接模拟即可. 由于数据范围较小,写得比较暴力,应该还有很大优化空间. #include<cstdio&g ...
- Objective -C学习笔记 之copy(复制)
//自定义类对象实现copy需要遵守copy协议(否则程序崩溃),实现必须实现的协议方法,里面的代码就决定了你的copy是深是浅 #import <Foundation/Foundation.h ...
- wpf的毛边窗体效果 前台代码
<Window x:Class="wpfwindowsmove.毛边窗体" xmlns="http://schemas.microsoft.com/w ...
- 网摘 窗体的旋转效果 wpf
<Window x:Class="simplewpf.chuantixx" Name="DW1" xmlns="http://s ...