• <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不會了 昨天吃晚飯回來就做,到走才知道題目意思看錯了,《岳陽樓記》也不會了
            。。。。。郁悶,代碼很爛,不發了
            posted on 2009-02-20 09:25 KNIGHT 閱讀(270) 評論(0)  編輯 收藏 引用
            <2009年3月>
            22232425262728
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            Friends

            OJ

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            欧美日韩成人精品久久久免费看| 亚洲伊人久久大香线蕉综合图片| 国产精品一区二区久久精品| 久久久久中文字幕| 久久婷婷是五月综合色狠狠| 无码人妻久久久一区二区三区| 狠狠色丁香婷婷综合久久来| 亚洲欧洲久久久精品| 大伊人青草狠狠久久| 亚洲伊人久久综合影院| 久久国产乱子伦精品免费强| 青青草国产97免久久费观看| 久久亚洲国产成人精品性色| 久久精品一区二区影院| 久久丫精品国产亚洲av不卡| 久久乐国产精品亚洲综合| 青青草原精品99久久精品66| 精品久久久久久国产免费了| 97久久国产亚洲精品超碰热| 亚洲国产成人精品91久久久 | 久久综合久久综合九色| 久久午夜夜伦鲁鲁片免费无码影视 | 韩国无遮挡三级久久| 99精品国产综合久久久久五月天| 久久精品国产精品亚洲| 国产精品久久波多野结衣| 久久人人爽人人爽人人片AV不 | 久久发布国产伦子伦精品| 亚洲精品美女久久久久99小说| 欧美一区二区精品久久| 久久精品亚洲中文字幕无码麻豆| 国产精品久久婷婷六月丁香| 日韩va亚洲va欧美va久久| 久久成人国产精品一区二区| 93精91精品国产综合久久香蕉| 国内精品伊人久久久久AV影院| 亚洲va久久久噜噜噜久久男同| 99久久国产亚洲综合精品| 久久国产色av免费看| 久久久久波多野结衣高潮| 伊人久久大香线蕉av不卡|