problem description
a wqb-number, or b-number for short, is a non-negative integer whose decimal form contains the sub- string "13" and can be divided by 13. for example, 130 and 2613 are wqb-numbers, but 143 and 2639 are not. your task is to calculate how many wqb-numbers from 1 to n for a given integer n.
input
process till eof. in each line, there is one positive integer n(1 <= n <= 1000000000).
output
print each answer in a single line.
sample input
13100200
1000
sample output
1122
題意:找出1~n範圍內含有13並且能被13整除的數字的個數
/***
hdu 3652 數字dp(含13且被能被13整除的數)
題目大意:求出給定區間內的數字含有「13」並且能被13整除的個數
解題思路:記憶化搜尋。
dp[i][j][k][z]:i:處理的數字,j:該數對13取模以後的值,k:是否已經包含13,z結尾的數
*/
#include #include #include #include using namespace std;
int dp[10][15][2][10],bit[10];
int dfs(int pos,int mod,int t,int now,int flag)
if(!flag)dp[pos][mod][t][now]=ans;
return ans;
} int solve(int n)
return dfs(len-1,0,0,0,1);
} int main()
return 0;
}
數字DP與記憶化搜尋 HDU3652
上題目b number b number problem description a wqb number,or b number for short,is a non negative integer whose decimal form contains the sub string 13 an...
HDU 3652 數字DP 解題報告
b number problem description a wqb number,or b number for short,is a non negative integer whose decimal form contains the sub string 13 and can be div...
HDU 3652 數字DP 套路題
題意 統計能被13整除和含有13的數的個數 解法沒法好說的.學了前面兩道直接啪出來了 ps.hdu深夜日常維護,沒法交題,拿網上的 隨便對拍一下,輸出一致 include define rep i,j,k for register int i j i k i using namespace std ...