51nod 1042 數字0 9的數量(數字dp)

2021-08-01 02:42:26 字數 532 閱讀 6656

做法同51nod 1009 數字1的數量 相差不多,不過查詢0的時候要特別處理,做的時候拿別人**調了好久才看懂。。。參考的:

#include 

#include

using

namespace

std;

typedef

long

long ll;

ll dp[20];

void init()

ll solve(ll num, ll aim)

else

if(cur == aim)

else

//現在記錄的tail就是下一輪迴圈中當cur==aim時的aim000-aim***的最高位為aim的情況

tail = tail + cur*ten;

ten *= 10;

}//處理0

if(!aim)

}return res;

}int main()

return

0;}

51nod 1042 數字0 9的數量

提問8 1 t擇責x 插入 本地 引用 支援 jpg gif png 格式,不要超過 2mb 確定id mentioneditoruploadiframe name mentioneditoruploadiframe src about blank frameborder 0 marginwidth...

51nod 1042 數字0 9的數量

1042 數字0 9的數量 基準時間限制 1 秒 空間限制 131072 kb 分值 10 難度 2級演算法題 給出一段區間a b,統計這個區間內0 9出現的次數。比如 10 19,1出現11次 10,11,12,13,14,15,16,17,18,19,其中11包括2個1 其餘數字各出現1次。in...

51nod 1042 數字0 9的數量

給出一段區間a b,統計這個區間內0 9出現的次數。比如 10 19,1出現11次 10,11,12,13,14,15,16,17,18,19,其中11包括2個1 其餘數字各出現1次。input 兩個數a,b 1 a b 10 18 output 輸出共10行,分別是0 9出現的次數input示例 ...