• <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
            World Cup
            Time Limit: 1000MS Memory Limit: 65536K
            Total Submissions: 3257 Accepted: 1710

            Description

            A World Cup of association football is being held with teams from around the world. The standing is based on the number of points won by the teams, and the distribution of points is done the usual way. That is, when a teams wins a match, it receives 3 points; if the match ends in a draw, both teams receive 1 point; and the loser doesn’t receive any points.

            Given the current standing of the teams and the number of teams participating in the World Cup, your task is to determine how many matches ended in a draw till the moment.

            Input

            The input contains several test cases. The first line of a test case contains two integers T and N, indicating respectively the number of participating teams (0 ≤ T ≤ 200) and the number of played matches (0 ≤ N ≤ 10000). Each one of the T lines below contains the name of the team (a string of at most 10 letter and digits), followed by a whitespace, then the number of points that the team obtained till the moment. The end of input is indicated by T = 0.

            Output

            For each one of the test cases, your program should print a single line containing an integer, representing the quantity of matches that ended in a draw till the moment.

            Sample Input

            3 3
            Brasil 3
            Australia 3
            Croacia 3
            3 3
            Brasil 5
            Japao 1
            Australia 1
            0 0

            Sample Output

            0
            2
            貪心,沒技術(shù)含量的一個題
            代碼如下
            #include<stdio.h>
            #include
            <string.h>
            int?main(){
            ????
            int?n,m,i,j;
            ????
            char?str[20];
            ????
            int?goal,sum;
            ????
            while(scanf("%d%d",&n,&m)!=EOF){
            ????????
            if(n==0&&m==0)break;
            ????????sum
            =0;
            ????????
            for(i=0;i<n;i++){
            ????????????getchar();
            ????????????scanf(
            "%s?%d",str,&goal);
            ????????????sum
            +=goal;
            ????????}

            ????????
            while(1){
            ????????????
            if(sum==2*m)break;
            ????????????sum
            -=3;
            ????????????m
            --;????
            ????????}

            ????????printf(
            "%d\n",m);????
            ????}
            ????
            }

            posted on 2009-02-20 11:00 KNIGHT 閱讀(137) 評論(0)  編輯 收藏 引用

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


            <2009年2月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            1234567

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            Friends

            OJ

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            波多野结衣久久| 99久久久精品免费观看国产| 久久精品中文字幕久久| 久久免费美女视频| 久久精品无码专区免费| 狠狠色狠狠色综合久久| 久久午夜无码鲁丝片秋霞 | 色婷婷综合久久久久中文| 精品乱码久久久久久久| 国产精品永久久久久久久久久| 亚洲а∨天堂久久精品9966| 亚洲中文精品久久久久久不卡 | 99久久99久久| 蜜桃麻豆www久久国产精品| 亚洲国产欧洲综合997久久| 久久美女网站免费| 久久午夜羞羞影院免费观看| 久久久久亚洲精品男人的天堂| 亚洲AV无码久久精品狠狠爱浪潮 | 久久精品成人| 人妻无码久久一区二区三区免费| 国产精品丝袜久久久久久不卡| 免费久久人人爽人人爽av| 久久久国产精品| 久久综合欧美成人| 久久久久成人精品无码中文字幕| 亚洲国产精品无码久久青草| 国产一区二区精品久久岳| 色狠狠久久AV五月综合| 亚洲国产精品无码久久九九| 久久国产成人午夜aⅴ影院| 精品午夜久久福利大片| 久久久久久午夜成人影院| 精品国产乱码久久久久久呢| 久久一本综合| 一本大道久久东京热无码AV| 久久精品国产欧美日韩| 久久亚洲AV无码西西人体| 久久久久无码精品国产app| 久久精品国产色蜜蜜麻豆| 久久er国产精品免费观看8|