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

            哇哦~這就是我

            This is my way ~
            <2008年4月>
            303112345
            6789101112
            13141516171819
            20212223242526
            27282930123
            45678910

            統計

            • 隨筆 - 10
            • 文章 - 0
            • 評論 - 2
            • 引用 - 0

            常用鏈接

            留言簿(1)

            隨筆檔案

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            我恨死這道題了。。。。。。

            我就是不理解這個投票規則,對這題整整困惑了12個小時,從下午5點到凌晨5點。。。。。。。
            Long March Voting 

            Description

            Instant run-off voting is a system for selecting the most preferred candidate in an election. At the beginning of the process, each voter ranks the candidates from most preferred to least preferred. A series of automated voting rounds are then held to determine the overall winner.

            In each round, each voter casts a single vote for his most preferred remaining candidate. If a candidate receives strictly more than 50% of the votes cast in that round, that candidate is declared the winner of the election. Otherwise, the candidate with the fewest votes in that round is eliminated, and another round is held. If multiple candidates are tied for the least number of votes, they are all eliminated. If all the candidates are eliminated, the election ends without a winner.

            You are given the preferences of the voters in an election, and you must determine the outcome. There are M candidates numbered 0 to M-1, inclusive. The preferences are given in N lines, where each element describes the preferences of a single voter. This is a permutation of the digits 0 to M-1 in decreasing order of preference. In other words, the first digit is the voter's most preferred candidate, the second digit is his second most preferred candidate, and so on.

            Input

            There are several test cases,each test case begins with a integer N(1<=N<=50),means there are N voters.The next N lines,each contains a string with the same lenth M(1<=M<=10).Each element of a voter will be a permutation of the digits between 0 and M-1. There is a blank line between each test case.

            Output

            For each test case,output the number of the candidate who wins the election, or -1 if the election ends without a winner.

            Sample Input

            5
            120
            102
            210
            021
            012

            8
            3120
            3012
            1032
            3120
            2031
            2103
            1230
            1230
             

            Sample Output

            1
            -1


            Hint:
            Case 1:
            Nobody gets an absolute majority in the first round and candidate 2 is eliminated. Candidate 1 then receives 3 votes in the next round, giving an absolute majority.

            Case 2:
            Candidate 0 is eliminated in the first round of voting. Candidate 2 is eliminated in the second round. In the third round, candidates 1 and 3 get 4 votes each. Neither candidate receives an absolute majority, and they are both eliminated for having the least number of votes, so the election ends without a winner.


             

            這題的投票,每輪都是從第一個數開始找的,找到第一個沒有被淘汰的人。
            我一開始以為之前幾輪選的人,在后面不能被選了。。。。

            posted on 2008-03-31 20:57 chinaeli 閱讀(302) 評論(0)  編輯 收藏 引用

            久久人人爽人人人人爽AV| 久久亚洲av无码精品浪潮| 久久久久久久久久免免费精品| 99久久精品免费看国产一区二区三区| 精品99久久aaa一级毛片| 热久久国产精品| 99久久人妻无码精品系列蜜桃| 欧美一区二区三区久久综合| 精品综合久久久久久97| 亚洲愉拍99热成人精品热久久| 色综合久久综合中文综合网| 久久久久99精品成人片欧美| 性欧美大战久久久久久久久| 99久久无色码中文字幕| 麻豆精品久久久一区二区| 久久国产香蕉一区精品| 亚洲精品国产自在久久| 亚洲色欲久久久综合网| avtt天堂网久久精品| 夜夜亚洲天天久久| 日本精品久久久久影院日本| 2021国产精品久久精品| 久久99国产乱子伦精品免费| 亚洲综合精品香蕉久久网97| 午夜精品久久久久久| 久久久久亚洲av无码专区喷水| 99精品久久久久中文字幕| 久久久精品国产亚洲成人满18免费网站| 久久久久九国产精品| 少妇久久久久久久久久| 亚洲国产精品久久| 大香伊人久久精品一区二区| 精品久久久久久中文字幕人妻最新| 国产ww久久久久久久久久| 奇米影视7777久久精品人人爽| 精品久久久久久久无码| 色婷婷久久综合中文久久一本| 久久久久人妻一区二区三区vr| 国产精品亚洲综合专区片高清久久久| 精品多毛少妇人妻AV免费久久 | 综合网日日天干夜夜久久|