Blog·Tanky WooABOUTRSS

HDOJ 2089 不要62

27 Jul 2010
这篇博客是从旧博客 WordPress 迁移过来,内容可能存在转换异常。

打表,不然会超时~~~

HOHO

 // Accepted 2089 140MS 4092K 686B C++ Tanky Woo 
// Author: Tanky Woo
// HDOJ 2089
#include 
using namespace std;
// www.wutianqi.com
int m, n;
int dabiao[1000001];
bool Is_no_good(int i)
{
    int temp = i;
    while(temp)
    {
        if(temp % 10 == 4)
            return 1;
        temp /= 10;
    }
    temp = i;
    while(temp)
    {
        if(temp % 100 == 62)
            return 1;
        temp /= 10;
    }
    return 0;
}

int main()
{
    //freopen("dabiao.txt", "w", stdout);
    dabiao[0] = 0;
    for(int i = 1; i < 1000001; ++i)
        if(Is_no_good(i))
            dabiao[i] = 0;
        else
            dabiao[i] = 1;
    while(scanf("%d %d", &m;, &n;) && (m||n))
    {
        int cnt = 0;
        for(int i = m; i <= n; ++i)
            if(dabiao[i])
                cnt++;
        printf("%d\n", cnt);
    }
    re