poj 2282 The Counting Problem 按位统计
2015-04-09 00:50
344 查看
同poj3286
//poj 2282 //sep9 #include<iostream> using namespace std; typedef __int64 ll; ll b[16]; ll f(ll n,ll x) { ll left,m,ans=0; for(ll i=1;i<13;++i){ left=n/b[i]-(x==0); ans+=left*b[i-1]; m=(n%b[i]-n%b[i-1])/b[i-1]; if(m>x) ans+=b[i-1]; else if(m==x) ans+=n%b[i-1]+1; if(b[i]>n) break; } return ans; } int main() { ll m,n; b[0]=1; for(int i=1;i<=12;++i) b[i]=b[i-1]*10; while(scanf("%I64d%I64d",&m,&n)&&(m+n)){ if(m>n) swap(n,m); for(ll i=0;i<10;++i) printf("%I64d ",f(n,i)-f(m-1,i)); printf("\n"); } return 0; }
相关文章推荐
- POJ - 2282 - The Counting Problem - (计数问题)
- The Counting Problem - POJ 2282 数位dp
- POJ 2282 The Counting Problem
- POJ2282:The Counting Problem(数位DP)
- POJ 2282 The Counting Problem & POJ 3286 How many 0's?(按位计算贡献)
- POJ 2282 The Counting Problem
- POJ 2282 The Counting Problem
- POJ 2282 && HDU 1663 The Counting Problem(数论)
- POJ题目2282 The Counting Problem(数学)
- poj 2282 The Counting Problem & 3286 How many 0's?
- POJ 2282 The Counting Problem,组合数学
- [POJ] 2282 -> The Counting Problem
- POJ 2282-The Counting Problem(组合数学_区间计数)
- poj2282 The Counting Problem
- poj 2282 The Counting Problem && poj 3286 How many 0's? (数位dp)
- poj 2282 The Counting Problem (数位DP)
- 统计区间[a,b]各个数字出现的个数:poj 2282 The Counting Problem poj 3286
- POJ 2282 The Counting Problem (数位dp)
- Poj 2282 The Counting Problem[统计区间 0 - 9出现的次数]
- (Realx 数论1.28)POJ 2282 The Counting Problem(区间统计数字:统计a、b之间各个数字(0~9)出现的次数)