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

            公告

            記錄我的生活和工作。。。
            <2012年6月>
            272829303112
            3456789
            10111213141516
            17181920212223
            24252627282930
            1234567

            統計

            • 隨筆 - 182
            • 文章 - 1
            • 評論 - 41
            • 引用 - 0

            留言簿(10)

            隨筆分類(70)

            隨筆檔案(182)

            文章檔案(1)

            如影隨形

            搜索

            •  

            最新隨筆

            最新評論

            閱讀排行榜

            評論排行榜

            SRM 303U

            DIV2 1000

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

            暴力解決就OK,next_permutation 的復雜度要計算準確!不是簡單的數目的階乘!!

             

            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 閱讀(149) 評論(0)  編輯 收藏 引用 所屬分類: Algorithm

            統計系統
            成人亚洲欧美久久久久| 97久久香蕉国产线看观看| 91精品国产91久久久久福利| 久久综合给合久久狠狠狠97色69| 久久久久AV综合网成人| 欧美综合天天夜夜久久| 久久久久久精品免费免费自慰| 久久久久久久人妻无码中文字幕爆 | 久久久精品人妻一区二区三区四| 久久国产色AV免费观看| 久久夜色精品国产| 久久中文娱乐网| 久久久久久久久久久| 99久久精品免费看国产免费| 精品久久久久中文字幕日本| 久久亚洲sm情趣捆绑调教 | 亚洲精品tv久久久久久久久久| 精品午夜久久福利大片| 久久亚洲精品无码AV红樱桃| 色偷偷888欧美精品久久久| 人妻无码αv中文字幕久久琪琪布| 久久精品一区二区国产| 亚洲精品美女久久久久99| 色综合久久夜色精品国产| 久久精品无码免费不卡| 久久久久成人精品无码| 精品久久久久久成人AV| 亚洲熟妇无码另类久久久| 伊人久久大香线蕉av不卡| 久久不见久久见免费影院www日本| 久久久久99精品成人片牛牛影视| 国产午夜久久影院| 久久99精品国产麻豆宅宅| 国产亚洲综合久久系列| 97久久超碰国产精品2021| 新狼窝色AV性久久久久久| 久久精品成人欧美大片| 中文字幕乱码人妻无码久久 | 久久久久久人妻无码| 精品久久久久久无码专区不卡| 久久香综合精品久久伊人|