题意 Language:DefaultEspañol The Counting Problem Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 5070 Accepted: 2590 Description Given two integers a and b, we write the numbers between a and b, inclusive, in a list. Your task is to calcula…
The Counting Problem 询问区间\([a,b]\)中\(1\sim 9\)出现的次数,0 < a, b < 100000000. 解 显然为数位递推,考虑试填法,现在关键是求出方案数,于是设\(A[i]\)表示i位以内数字中0出现的次数,不含前导0,\(B[i]\)为i位数字中\(0\sim 9\)出现的次数,可以含前导0,不难有(其中\(base[i]=10^i\)),显然有 \[B[i]=10\times B[i-1]+base[i-1]\] \[A[i]=A[i-1]+…
Description Given two integers a and b, we write the numbers between a and b, inclusive, in a list. Your task is to calculate the number of occurrences of each digit. For example, if a = 1024 and b = 1032, the list will be 1024 1025 1026 1027 1028 10…