• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            學習心得(code)

            superlong@CoreCoder

              C++博客 :: 首頁 :: 聯系 :: 聚合  :: 管理
              74 Posts :: 0 Stories :: 5 Comments :: 0 Trackbacks

            公告

            文字可能放在http://blog.csdn.net/superlong100,此處存放代碼

            常用鏈接

            留言簿(4)

            我參與的團隊

            搜索

            •  

            最新隨筆

            最新評論

            • 1.?re: Poj 1279
            • 對于一個凹多邊形用叉積計算面積 后能根據結果的正負來判斷給的點集的時針方向?
            • --bsshanghai
            • 2.?re: Poj 3691
            • 你寫的這個get_fail() 好像并是真正的get_fail,也是說fail指向的串并不是當前結點的子串。為什么要這樣弄呢?
            • --acmer1183
            • 3.?re: HDU2295[未登錄]
            • 這個是IDA* 也就是迭代加深@ylfdrib
            • --superlong
            • 4.?re: HDU2295
            • 評論內容較長,點擊標題查看
            • --ylfdrib
            • 5.?re: HOJ 11482
            • 呵呵..把代碼發在這里很不錯..以后我也試試...百度的編輯器太爛了....
            • --csuft1

            閱讀排行榜

            評論排行榜

            #include <iostream>
            #include 
            <string>
            #include 
            <algorithm>
            #include 
            <cstdio>
            #include 
            <queue>
            #include 
            <map>
            #define MAX 1000000000001LL
            using namespace std;

            queue 
            < long long > q;
            map 
            < long longbool > mym;
            long long ans[500001], num[500001];
            int     len, ll;


            void pre_for_lucky()
            {
                
            long long x;
                len 
            = 0;
                
            while(!q.empty()) q.pop();
                mym.clear();
                q.push(
            4);    q.push(7);
                ans[
            ++ len] = 4;     ans[++ len] = 7;
                
            while(!q.empty())
                {
                    x 
            = q.front();
                    q.pop();
                    
            if( x * 10 + 4 <= MAX && !mym[x * 10 + 4])
                    {
                        ans[
            ++len] = x * 10 + 4;
                        mym[x 
            * 10 + 4= 1;
                        q.push(x 
            * 10 + 4);
                    }
                    
            if( x * 10 + 7 <= MAX && !mym[x * 10 + 7])
                    {
                        ans[
            ++len] = x * 10 + 7;
                        mym[x 
            * 10 + 7= 1;
                        q.push(x 
            * 10 + 7);
                    }
                }    
            }
            void dfs(long long x, int index)
            {
                
            long long temp;
                
            int i;
                
            for(i = index; i <= len; i ++)
                {
                    temp 
            = MAX / x;
                    
            if(temp < ans[i]) return;
                    num[
            ++ ll] = x * ans[i];
                    dfs(num[ll], i);
                }
            }



            int bsearch(long long x, int inc)
            {
                
            int l = 0, r = len + 1, mid = (l + r) / 2;
                
            if(x < ans[1])   return inc;
                
            if(x > ans[len]) return len + inc;
                
            while(l < r)
                {
                    
            if(ans[mid] == x)         return mid;
                    
            if(ans[mid + 1== x)   return mid + 1;
                    
            if(ans[mid] < x && ans[mid + 1> x)
                        
            return mid + inc;
                    
            if(ans[mid] > x)
                    {
                        r 
            = mid;
                        mid 
            = (l + r) / 2;
                    }
                    
            else if(ans[mid] < x)
                    {
                        l 
            = mid;
                        mid 
            = (l + r) / 2;
                    }
                }
            }


            int main()
            {
                freopen(
            "in.txt","r",stdin);
                
            int test;
                
            long long l, r;
                pre_for_lucky();
                ll 
            = 0;
                dfs(
            11);
                num[
            0= 0;
                num[ll 
            + 1= MAX;
                sort(num 
            + 1, num + ll + 1);
                len 
            = 0;
                
            for(int i = 1; i <= ll; i ++)
                    
            if(num[i] != num[i - 1]) 
                        ans[
            ++len] = num[i];
                scanf(
            "%d"&test);
                
            while(test --)
                {
                    scanf(
            "%I64d %I64d"&l, &r);
                    printf(
            "%d\n",bsearch(r, 0- bsearch(l, 1+ 1);
                }
            }

            posted on 2009-08-30 17:58 superlong 閱讀(422) 評論(0)  編輯 收藏 引用
            办公室久久精品| 69SEX久久精品国产麻豆| 久久最新精品国产| 一本色道久久88加勒比—综合| 久久99国产综合精品女同| 久久国产一区二区| 久久精品三级视频| 波多野结衣久久| 国产精品久久久久久影院 | 久久久无码人妻精品无码| 国产精品一久久香蕉国产线看| 欧美色综合久久久久久| 久久久精品国产sm调教网站 | 久久精品国产99久久丝袜| 亚洲Av无码国产情品久久| 精品久久久久久亚洲精品| 久久一区二区免费播放| 久久久久久久尹人综合网亚洲| 亚洲精品tv久久久久久久久久| 97久久天天综合色天天综合色hd| 日韩欧美亚洲国产精品字幕久久久| 亚洲乱码中文字幕久久孕妇黑人| 国产成人久久精品二区三区| 狠狠88综合久久久久综合网 | 久久久中文字幕| 久久99这里只有精品国产| 成人亚洲欧美久久久久| 国产亚洲精品自在久久| 亚洲成色WWW久久网站| 中文字幕无码久久人妻| 日日狠狠久久偷偷色综合免费| 国产 亚洲 欧美 另类 久久| 色欲久久久天天天综合网 | 狠狠色丁香久久综合五月| 人妻无码αv中文字幕久久| 久久天天躁狠狠躁夜夜不卡| 国产精品女同一区二区久久| 国产精品99久久精品爆乳| 久久国产精品波多野结衣AV| 久久精品国产99国产精品| 人妻少妇精品久久|