hdu 4722】的更多相关文章

原题直通车: HDU  4722  Good Numbers 题意: 求区间[a,b]中各位数和mod 10==0的个数. 代码: #include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; int f[20]; long long work(long long x){ long long ret=0, u=x; int t=0, s=0…
http://acm.hdu.edu.cn/showproblem.php?pid=4722 [题意]: 找GoodNumbers一个数N,如果它每一个位数字之和可以整除10,那么它就是GoodNumbers,比如451就是一个4+5+1=10,求[A,B]之间这样的数的个数 [题解]: 先写一个暴力代码用来找规律 发现: 0-10    1 0-100  10 0-1000   100 0-990  99 0-992  100 0-997   100 基本规律为 n/10 + (1或0) 加1…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4722 Good Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 422    Accepted Submission(s): 146 Problem Description If we sum up every digit o…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4722 题目大意:给定一个区间,求区间中有多少个满足每位上的数的和是10的倍数. 解题思路:先打表暴力求出前200项符合条件的个数,然后再找规律. 0~9    0    1个 10~19  9   1个 20~-29  18  1个 0~100         10个 0~200         20个 基本规律:r/10-(l-1)/10;只需要找两端点是否在范围内即可 #include<cstd…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4722 思路:简单的记忆化搜索,留意一下A==0时的情况就可以了. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long ll; ]; ll dp[][]; ll dfs(int pos,int…
题目链接 脑子有点乱,有的地方写错了,尚大婶鄙视了... 来个模版的. #include <iostream> #include <cstdio> #include <cstring> using namespace std; #define LL __int64 LL dp[][]; ]; LL dfs(int pos,int pre,int bound) { int end,tpre,i; LL ans = ; ) ; ) return dp[pos][pre];…
数位DP!!! 代码如下: #include<iostream> #include<stdio.h> #include<algorithm> #include<iomanip> #include<cmath> #include<cstring> #include<vector> #define ll __int64 #define pi acos(-1.0) #define MAX 50000 using namespac…
比赛的时候这道题一直都没出来,承启提醒我之后还是一直WA: 其实规律早就找到了```` 其实这题还可以用数位dp来做,不过从来没写过,以后再贴: 代码: #include<iostream> #define ll long long using namespace std; ll get(ll n) { ; ll i=n/*; ll m=n,ans=; for(;i<=m;i++) { n=i; s=; while(n) { s+=n%; n/=; } ==) ans++; } retu…
Good Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4753    Accepted Submission(s): 1511 Problem Description If we sum up every digit of a number and the result can be exactly divided b…
Description If we sum up every digit of a number and the result can be exactly divided by 10, we say this number is a good number.  You are required to count the number of good numbers in the range from A to B, inclusive.   Input The first line has a…