• <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>
            posts - 74,  comments - 33,  trackbacks - 0
            Balance
            Time Limit: 1000MS Memory Limit: 30000K
            Total Submissions: 1159 Accepted: 553

            Description

            Gigel has a strange "balance" and he wants to poise it. Actually, the device is different from any other ordinary balance.
            It orders two arms of negligible weight and each arm's length is 15. Some hooks are attached to these arms and Gigel wants to hang up some weights from his collection of G weights (1 <= G <= 20) knowing that these weights have distinct values in the range 1..25. Gigel may droop any weight of any hook but he is forced to use all the weights.
            Finally, Gigel managed to balance the device using the experience he gained at the National Olympiad in Informatics. Now he would like to know in how many ways the device can be balanced.

            Knowing the repartition of the hooks and the set of the weights write a program that calculates the number of possibilities to balance the device.
            It is guaranteed that will exist at least one solution for each test case at the evaluation.

            Input

            The input has the following structure:
            ? the first line contains the number C (2 <= C <= 20) and the number G (2 <= G <= 20);
            ? the next line contains C integer numbers (these numbers are also distinct and sorted in ascending order) in the range -15..15 representing the repartition of the hooks; each number represents the position relative to the center of the balance on the X axis (when no weights are attached the device is balanced and lined up to the X axis; the absolute value of the distances represents the distance between the hook and the balance center and the sign of the numbers determines the arm of the balance to which the hook is attached: '-' for the left arm and '+' for the right arm);
            ? on the next line there are G natural, distinct and sorted in ascending order numbers in the range 1..25 representing the weights' values.

            Output

            The output contains the number M representing the number of possibilities to poise the balance.

            Sample Input

            2 4	
            -2 3 
            3 4 5 8
            

            Sample Output

            2

            Source

            Romania OI 2002
            郁悶了,dp不會(huì)了 昨天吃晚飯回來就做,到走才知道題目意思看錯(cuò)了,《岳陽樓記》也不會(huì)了
            。。。。。郁悶,代碼很爛,不發(fā)了
            posted on 2009-02-20 09:25 KNIGHT 閱讀(273) 評(píng)論(0)  編輯 收藏 引用

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            <2009年1月>
            28293031123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            Friends

            OJ

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            亚洲国产另类久久久精品| 国产AV影片久久久久久| 国产A三级久久精品| 成人国内精品久久久久一区| 久久国产成人午夜aⅴ影院| 国产色综合久久无码有码| 精品熟女少妇av免费久久| 久久乐国产精品亚洲综合| 97久久国产亚洲精品超碰热 | 国产成人久久精品一区二区三区 | 日本精品一区二区久久久| 久久午夜无码鲁丝片| 中文字幕精品久久久久人妻| 精品久久香蕉国产线看观看亚洲 | 午夜福利91久久福利| 伊人久久大香线蕉精品| 久久久久久久久无码精品亚洲日韩 | 国产高潮久久免费观看| 久久天天躁狠狠躁夜夜躁2O2O| 久久精品一区二区影院| 久久久91精品国产一区二区三区 | 久久国产视频网| 青青青国产成人久久111网站| 久久久国产精品亚洲一区| 少妇高潮惨叫久久久久久| 99精品久久久久久久婷婷 | 久久久久久亚洲精品成人| 无码精品久久久久久人妻中字| 无码国内精品久久综合88| 久久久久这里只有精品| 久久强奷乱码老熟女| 久久婷婷五月综合色99啪ak | 国产亚洲美女精品久久久| 久久国产精品成人免费| 国产精品久久久久无码av| 久久精品国产亚洲AV麻豆网站| 午夜天堂精品久久久久| 久久ZYZ资源站无码中文动漫| 韩国免费A级毛片久久| 久久电影网2021| 久久伊人影视|