标签:结束 string ble out fine color iss code algo
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 41353 Accepted Submission(s):
15070
#define _CRT_SECURE_NO_DEPRECATE #include<iostream> #include<algorithm> #include<string> #include<cmath> #include<set> #include<queue> using namespace std; const int N_MAX = 1000000; bool is_Jili[N_MAX+1]; void judge(int n) { for (int i = 4; i <= n;i++) { int k = i; while (k) { int mod = k % 10; k /= 10; if (mod == 4)is_Jili[i] = false; while (mod == 2) { mod = k % 10; k /= 10; if (mod == 6||mod==4)is_Jili[i] = false; } } } } int main() { int n, m; for (int i = 0; i < N_MAX; i++) is_Jili[i] = 1; judge(N_MAX); while (scanf("%d%d",&n,&m)&&n) { int sum = 0; for (int i = n; i <= m; i++) { sum += is_Jili[i]; } printf("%d\n",sum); } return 0; }
标签:结束 string ble out fine color iss code algo
原文地址:http://www.cnblogs.com/ZefengYao/p/6731041.html