Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

二分加数位dp

Posted by CuriousCat at 2017-03-08 21:09:20 on Problem 3208
dp[0][0][0][0] = 1; 
ull res = 0, ls = s.size();
REP(i, ls) REP(j, 3) REP(k, 2) REP(l, 2) REP(num, 10) {
	int ni = i + 1, nj = num == 6 ? j + 1 : 0, nk = k, nl = l;
	if (num < s[i] - '0') nl = 1;
	if (nj == 3) nj = 0, nk = 1;
	if (!nl && num > s[i] - '0') continue;
	dp[ni][nj][nk][nl] += dp[i][j][k][l];
}
REP(j, 3) REP(l, 2) res += dp[s.size()][j][1][l];

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator