• <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>

            O(1) 的小樂

            Job Hunting

            公告

            記錄我的生活和工作。。。
            <2010年11月>
            31123456
            78910111213
            14151617181920
            21222324252627
            2829301234
            567891011

            統(tǒng)計(jì)

            • 隨筆 - 182
            • 文章 - 1
            • 評(píng)論 - 41
            • 引用 - 0

            留言簿(10)

            隨筆分類(70)

            隨筆檔案(182)

            文章檔案(1)

            如影隨形

            搜索

            •  

            最新隨筆

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            SRM 303U

            DIV2 1000

            使用一個(gè)整數(shù)的所有素因子能否組成一個(gè)回文字符串?要求數(shù)出在A與B之間滿足要求的這樣的整數(shù)的數(shù)目。

            暴力解決就OK,next_permutation 的復(fù)雜度要計(jì)算準(zhǔn)確!不是簡(jiǎn)單的數(shù)目的階乘!!

             

            template<class T> string toString(T n){ostringstream ost;ost<<n;ost.flush();return ost.str();}
            bool judge(string c)
            {
                for(int i=0; i<=c.size()/2; i++)
                {
                    if(c[i]!= c[c.size()-i-1]) return false;
                }
                return true;
            }
            bool func(int num)
            {
                vector<string> p;
                int temp = num;
                for(int i=2; i*i<=num; i++)
                {
                    while(temp % i==0)
                    {
                        p.push_back(toString(i));
                        temp/=i;
                    }
                }
                if(temp!=1) p.push_back(toString(temp));
                sort(p.begin(), p.end());
                do
                {
                    string c;
                    for(int i=0; i<p.size(); i++) c+=p[i];
                    if(judge(c)){ for(int i=0; i<p.size(); i++) cout<<p[i]<<" "; cout<<endl; return true;}
                }while(next_permutation(p.begin(), p.end()));
                return false;
            }
            class PrimePalindromic
            {
                public:
                    int count(int A, int B)
                    {
                        int ret = 0;
                        for(int i=A; i<=B; i++)
                            if(func(i)){ cout<<" "<<i<<endl;  ret++;}
                        return ret;
                    }
            };

            posted on 2012-06-01 16:39 Sosi 閱讀(153) 評(píng)論(0)  編輯 收藏 引用 所屬分類: Algorithm

            統(tǒng)計(jì)系統(tǒng)
            97久久综合精品久久久综合| 无码精品久久一区二区三区| 久久亚洲日韩精品一区二区三区 | 久久精品无码一区二区无码| 奇米影视7777久久精品| 久久被窝电影亚洲爽爽爽| 亚洲欧美日韩精品久久| 亚洲?V乱码久久精品蜜桃| 2021久久国自产拍精品| 伊人色综合九久久天天蜜桃| 国产精品久久久久无码av| 久久久久亚洲精品中文字幕| 久久久久99精品成人片试看| 精品久久久久久国产免费了| 亚洲av伊人久久综合密臀性色| 中文字幕亚洲综合久久2| 一本久久知道综合久久| 久久精品亚洲乱码伦伦中文 | 尹人香蕉久久99天天拍| 久久精品国产2020| 欧美麻豆久久久久久中文| 久久天天躁夜夜躁狠狠| 久久久久久国产a免费观看不卡| 91麻精品国产91久久久久| 国产精品久久久久一区二区三区| 国产L精品国产亚洲区久久| 99久久国产综合精品成人影院| 精品乱码久久久久久夜夜嗨| 亚洲七七久久精品中文国产| 国产精品久久久久免费a∨| 久久精品人人做人人爽97| 中文字幕成人精品久久不卡 | 97精品国产97久久久久久免费| 国产午夜久久影院| 久久超乳爆乳中文字幕| 久久妇女高潮几次MBA| 国产午夜免费高清久久影院| 久久精品日日躁夜夜躁欧美| 999久久久免费国产精品播放| 久久久久无码精品| 国产成人精品久久二区二区|