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

            學(xué)習(xí)心得(code)

            superlong@CoreCoder

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

            公告

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

            常用鏈接

            留言簿(4)

            我參與的團隊

            搜索

            •  

            最新隨筆

            最新評論

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

            閱讀排行榜

            評論排行榜

            Prime Cryptarithm

            The following cryptarithm is a multiplication problem that can be solved by substituting digits from a specified set of N digits into the positions marked with *. If the set of prime digits {2,3,5,7} is selected, the cryptarithm is called a PRIME CRYPTARITHM.

                  * * *
            x * *
            -------
            * * * <-- partial product 1
            * * * <-- partial product 2
            -------
            * * * *
            Digits can appear only in places marked by `*'. Of course, leading zeroes are not allowed.

            Note that the 'partial products' are as taught in USA schools. The first partial product is the product of the final digit of the second number and the top number. The second partial product is the product of the first digit of the second number and the top number.

            Write a program that will find all solutions to the cryptarithm above for any subset of digits from the set {1,2,3,4,5,6,7,8,9}.

            PROGRAM NAME: crypt1

            INPUT FORMAT

            Line 1: N, the number of digits that will be used
            Line 2: N space separated digits with which to solve the cryptarithm

            SAMPLE INPUT (file crypt1.in)

            5
            2 3 4 6 8

            OUTPUT FORMAT

            A single line with the total number of unique solutions. Here is the single solution for the sample input:

                  2 2 2
            x 2 2
            ------
            4 4 4
            4 4 4
            ---------
            4 8 8 4

            SAMPLE OUTPUT (file crypt1.out)

            1

            方法是暴利枚舉然后判斷 - -!
            /*
            ID: superlo1
            LANG: C++
            TASK: crypt1
            */

            #include 
            <iostream>
            using namespace std;

            int n, set[10];
            bool hash[11];

            bool check(int x, int flag)
            {
                
            int a[4], len = 0;
                
            while(x)
                {
                    a[
            ++len] = x % 10;
                    x 
            = x / 10;
                    
            if(hash[a[len]] == 0return false;
                }
                
            if(len > 3 && !flag) return false;
                
            return true;
            }

            int main()
            {
                freopen(
            "crypt1.in","r",stdin);
                freopen(
            "crypt1.out","w",stdout);
                scanf(
            "%d"&n);
                
            for(int i = 0; i < n; i ++)    
                {
                    scanf(
            "%d"&set[i]);
                    hash[
            set[i]] = 1;
                }
                
            int i, j, cnt = 0;
                
            for(i = 100; i <= 999; i ++)
                
            if(check(i, 0))
                {
                    
            for(j = 10; j <= 99; j ++)
                    
            if(check(j, 0&& check( (j % 10* i, 0
                    
            && check( (j / 10* i, 0&& check(i * j, 1))
                    {
                        
            //printf("%d %d\n",i,j);
                        cnt ++;
                    }
                }
                printf(
            "%d\n",cnt);
                
            //while(1);
            }

            posted on 2009-08-21 00:42 superlong 閱讀(209) 評論(0)  編輯 收藏 引用 所屬分類: USACO
            亚洲精品99久久久久中文字幕| 99久久无色码中文字幕人妻| 思思久久99热只有频精品66| 7国产欧美日韩综合天堂中文久久久久| 中文字幕无码久久久| 一级女性全黄久久生活片免费| 久久天天日天天操综合伊人av| 亚洲国产天堂久久综合网站| 88久久精品无码一区二区毛片| 99久久综合国产精品二区| 色综合久久综精品| 久久国产精品二国产精品| 四虎国产永久免费久久| 精品无码久久久久国产| 嫩草影院久久国产精品| 国产91久久综合| 久久亚洲高清综合| 久久99热这里只有精品66| 亚洲综合伊人久久大杳蕉| 久久丫精品国产亚洲av| 精品久久久久久综合日本| 97精品伊人久久久大香线蕉| 人妻丰满?V无码久久不卡| 伊人久久久AV老熟妇色| 久久久久免费精品国产| 人妻无码久久精品| 久久夜色精品国产噜噜麻豆| 精品综合久久久久久97超人| 久久午夜无码鲁丝片午夜精品| 99精品国产99久久久久久97| 精品久久香蕉国产线看观看亚洲| 久久乐国产精品亚洲综合 | 亚洲国产日韩综合久久精品| 国内精品人妻无码久久久影院导航| 色88久久久久高潮综合影院| 精品久久综合1区2区3区激情 | 久久人人爽爽爽人久久久| 国产精品久久影院| 色老头网站久久网| 2021国产成人精品久久| 亚洲精品国产美女久久久|