• <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年3月>
            2425262728291
            2345678
            9101112131415
            16171819202122
            23242526272829
            303112345

            統(tǒng)計(jì)

            • 隨筆 - 10
            • 文章 - 0
            • 評(píng)論 - 2
            • 引用 - 0

            常用鏈接

            留言簿(1)

            隨筆檔案

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

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

            我就是不理解這個(gè)投票規(guī)則,對(duì)這題整整困惑了12個(gè)小時(shí),從下午5點(diǎn)到凌晨5點(diǎn)。。。。。。。
            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.


             

            這題的投票,每輪都是從第一個(gè)數(shù)開(kāi)始找的,找到第一個(gè)沒(méi)有被淘汰的人。
            我一開(kāi)始以為之前幾輪選的人,在后面不能被選了。。。。

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

            色综合久久久久| 久久久久人妻精品一区三寸蜜桃| 国产精品永久久久久久久久久| 国产午夜精品久久久久九九电影| 久久精品国产99久久丝袜| 一本色道久久综合| 国内精品久久九九国产精品| 久久亚洲2019中文字幕| 久久亚洲私人国产精品| 色综合久久久久综合99| 国产亚洲色婷婷久久99精品| 久久中文字幕无码专区| 91精品国产综合久久久久久| 亚洲国产成人久久综合一区77| 无码超乳爆乳中文字幕久久| 性做久久久久久久久| 久久国产高清一区二区三区| 久久久久无码精品国产| 亚洲精品乱码久久久久久| 色欲久久久天天天综合网| 久久综合色区| 久久亚洲日韩看片无码| 一级A毛片免费观看久久精品| 久久精品中文字幕第23页| 久久九九久精品国产| 性做久久久久久免费观看| 久久这里的只有是精品23| 亚洲精品tv久久久久久久久久| 国内精品久久久久影院老司| 久久国产AVJUST麻豆| 久久综合香蕉国产蜜臀AV| 国产精品无码久久四虎| 思思久久99热只有频精品66| 中文字幕乱码人妻无码久久| www.久久热.com| 亚洲色欲久久久久综合网| 久久精品国产亚洲av水果派| 国产女人aaa级久久久级| 国产精品久久精品| 久久久av波多野一区二区| 婷婷久久精品国产|