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

            coreBugZJ

            此 blog 已棄。

            Vote, FZU 2011年3月月賽之 F, FZU 2015

            Problem 2015 Vote

            Time Limit: 1000 mSec    Memory Limit : 32768 KB

            Problem Description

            Here are n Candidates in one election. Every Candidate could vote any one (of course himself/herself). In this election, the one who gets more than half of n become the winner! However, sometimes no winner could be determined (No one gets more than half of n votes)!

            Now you are given the number of Candidates and the final winner m, here if m is equal to -1, then it means that no one wins, otherwise m is the index of the Candidate. (The index of Candidates is 0, 1, 2, … n – 1 respectively) Abcdxyzk wants to know the number of possible ways of the final result if the winner if m. (m = -1 for no winner of course) However, the answer maybe large, so abcdxyzk just want the remainder of the answer after divided by 1000000007.

            Input

            There are several test cases.

            For each case, only two integers n and m in a single line indicates n Candidates and the final winner m. (1 <= n <= 100, -1 <= m < n)

            Output

            For each test case, output the number of possible ways of the final election!

            Sample Input

            2 1
            3 -1
            4 1

            Sample Output

            1
            1
            4

            Hint

            In case 1, only one possible ways of the final result because both 0 and 1 vote to 1.

            In case 2, only one possible ways of the final result because all of 0, 1, and 2 get one vote.

            In case 3, there are 4 possible ways of final result:

            (1) 0: 1 (vote(s)) 1: 3 (vote(s)) 2: 0 (vote(s)) 3: 0 (vote(s))

            (2) 0: 0 (vote(s)) 1: 3 (vote(s)) 2: 1 (vote(s)) 3: 0 (vote(s))

            (3) 0: 0 (vote(s)) 1: 3 (vote(s)) 2: 0 (vote(s)) 3: 1 (vote(s))

            (4) 0: 0 (vote(s)) 1: 4 (vote(s)) 2: 0 (vote(s)) 3: 0 (vote(s))

            Source

            FOJ有獎月賽-2011年03月


            組合數。

            我的代碼:
             1 #include <stdio.h>
             2 
             3 typedef  long  long  Lint;
             4 
             5 #define  L  203
             6 #define  MOD  1000000007
             7 
             8 int c[ L ][ L ];
             9 
            10 int main() {
            11         int n, m, i, j, ans;
            12         for ( i = 0; i < L; ++i ) {
            13                 c[ i ][ 0 ] = c[ i ][ i ] = 1;
            14                 for ( j = 1; j < i; ++j ) {
            15                         c[ i ][ j ] = ( c[ i - 1 ][ j - 1 ] + c[ i - 1 ][ j ] ) % MOD;
            16                 }
            17         }
            18         while ( scanf( "%d%d"&n, &m ) == 2 ) {
            19                 if ( m < 0 ) {
            20                         ans = ( c[n+n-1][n] + (Lint)(MOD-c[(n-1)+(n-n/2-1)][n-1]) * n ) % MOD;
            21                 }
            22                 else {
            23                         ans = c[ (n-1+ (n-n/2-1) ][ n-1 ];
            24                 }
            25                 printf( "%d\n", ans );
            26         }
            27         return 0;
            28 }
            29 

            posted on 2011-03-23 22:46 coreBugZJ 閱讀(1476) 評論(0)  編輯 收藏 引用 所屬分類: ACM

            久久本道久久综合伊人| 久久免费视频6| 97久久久精品综合88久久| 精品久久久久久亚洲精品| 欧美成a人片免费看久久| 久久人人爽人爽人人爽av | 国产精品一久久香蕉国产线看| 99久久精品费精品国产一区二区| 97超级碰碰碰碰久久久久| 亚洲AV无码成人网站久久精品大| 国产精品一区二区久久精品无码 | 91精品国产91久久久久福利| 大美女久久久久久j久久| 国产亚洲美女精品久久久2020| 国产精品久久国产精品99盘| 青青草国产97免久久费观看| 99久久精品国产一区二区三区| 久久精品国产欧美日韩99热| 99久久精品免费看国产一区二区三区 | 欧洲性大片xxxxx久久久| 精品午夜久久福利大片| 亚洲精品美女久久777777| 久久综合色之久久综合| 久久综合九色综合欧美狠狠| 国产亚洲欧美成人久久片| 亚洲午夜久久久影院| 香港aa三级久久三级老师2021国产三级精品三级在 | 久久久精品久久久久影院| 久久精品国产亚洲Aⅴ蜜臀色欲| 91亚洲国产成人久久精品网址| 日产精品99久久久久久| 日韩人妻无码精品久久免费一| 亚洲精品无码久久不卡| 99久久国产宗和精品1上映| 久久午夜福利电影| 日本精品久久久中文字幕| 51久久夜色精品国产| 91精品国产高清久久久久久91| 国产亚洲美女精品久久久久狼| 久久精品国产亚洲av水果派| 亚洲国产精品久久|