标签:ott 杭州 == img ima code int 需要 cep
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 42615 Accepted Submission(s): 15587
附上大神的题目解析:
#include<iostream> #include<algorithm> using namespace std; int dp[10][10],num[10]; void init() { dp[0][0] = 1; for(int i=1;i<=7;i++) for(int j=0;j<10;j++) for (int k = 0; k < 10; k++) if (j != 4 && !(j == 6 && k == 2)) dp[i][j] += dp[i - 1][k]; } int solve(int n) { int ans = 0, t = 0; while (n) { num[++t] = n % 10; n /= 10; } num[t + 1] = 0; for (int i = t; i >= 1; i--) { for (int j = 0; j < num[i]; j++) { if (!(num[i + 1] == 6 && j == 2)) ans += dp[i][j]; } if (num[i] == 4 || (num[i + 1] == 6 && num[i] == 2)) break; } return ans; } int main() { init(); int n, m; while (cin >> n >> m,(n||m)) { cout << solve(m+1) - solve(n) << endl; } return 0; }
标签:ott 杭州 == img ima code int 需要 cep
原文地址:http://www.cnblogs.com/orion7/p/6925075.html