World Cup

Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other)
Total Submission(s) : 62   Accepted Submission(s) : 29
Problem 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
 
Source
PKU

 #include <stdio.h>
#include <stdlib.h> int main()
{
int T,n,a[],i,sign;
while(scanf("%d%d",&T,&n),T!=)
{
sign=;
while(T--)
{
scanf("%s",a);
scanf("%d",&i);
sign+=i;
}
printf("%d\n",n*-sign);
}
return ;
}

World Cup的更多相关文章

  1. java高cup占用解决方案

    项目中发现java cpu占用高达百分之四百,查看代码发现有一个线程在空转,拉高了cup while(true){ } 解决方案,循环中加入延迟:Thread.sleep(Time): 总结下排查CP ...

  2. UVALive 7147 World Cup(数学+贪心)(2014 Asia Shanghai Regional Contest)

    题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=6 ...

  3. uva 6757 Cup of Cowards(中途相遇法,貌似)

    uva 6757 Cup of CowardsCup of Cowards (CoC) is a role playing game that has 5 different characters (M ...

  4. 【转】关于KDD Cup '99 数据集的警告,希望从事相关工作的伙伴注意

    Features From: Terry Brugger Date: 15 Sep 2007 Subject: KDD Cup '99 dataset (Network Intrusion) cons ...

  5. Facebook Hacker Cup 2014 Qualification Round 竞赛试题 Square Detector 解题报告

    Facebook Hacker Cup 2014 Qualification Round比赛Square Detector题的解题报告.单击这里打开题目链接(国内访问需要那个,你懂的). 原题如下: ...

  6. DP VK Cup 2012 Qualification Round D. Palindrome pairs

    题目地址:http://blog.csdn.net/shiyuankongbu/article/details/10004443 /* 题意:在i前面找回文子串,在i后面找回文子串相互配对,问有几对 ...

  7. [BZOJ 3145][Feyat cup 1.5]Str 解题报告

    [Feyat cup 1.5]Str DescriptionArcueid,白姬,真祖的公主.在和推倒贵看电影时突然对一个问题产生了兴趣:我们都知道真祖和死徒是有类似的地方.那么从现代科学的角度如何解 ...

  8. HDU 2289 CUP 二分

    Cup Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...

  9. VK Cup 2012 Round 3 (Unofficial Div. 2 Edition)

    VK Cup 2012 Round 3 (Unofficial Div. 2 Edition) 代码 VK Cup 2012 Round 3 (Unofficial Div. 2 Edition) A ...

  10. UVALive 7275 Dice Cup (水题)

    Dice Cup 题目链接: http://acm.hust.edu.cn/vjudge/contest/127406#problem/D Description In many table-top ...

随机推荐

  1. 将可执行exe文件注册成windows服务

    要把应用程序添加为服务,你需要两个小软件:Instsrv.exe和Srvany.exe.Instsrv.exe可以给系统安装和删除服务,Srvany.exe可以让程序以服务的方式运行.这两个软件都包含 ...

  2. Java内部类的使用小结

    转载:http://android.blog.51cto.com/268543/384844/ Java内部类的使用小结 内部类是指在一个外部类的内部再定义一个类.类名不需要和文件夹相同. *内部类可 ...

  3. sybase 修改用户密码

    命令行输入 isql -Usa -P123456 将sa口令设置为NULL(当前口令为"123456"):  sp_password '123456',NULL,sa

  4. GPS定位开发

    1.概述 在iOS开发中,要想加入地图和定位功能这2大功能,必须基于2个框架进行开发 (1)Map Kit :用于地图展示 (2)Core Location :用于地理定位 2个热门专业术语: LBS ...

  5. javaWEB总结(14):请求的转发和重定向

    通俗理解请求转发与重定向的流程 通俗的来讲:我们可以把请求转发和重定向当成是一种借钱的情景模式. (1)请求的转发:A向B借钱,B自己没有钱,但是向C借到了钱,并且把钱借给了A.A只向B请求了一次. ...

  6. weex 语法高亮

    @1.ctrl+shift+p,调出控制命令面板,@2.输入pic,点击进入 @3.输入vue Syntax Highlight,等待下载 所有的sublime下载插件同理. vue Syntax H ...

  7. 2016 Technology

    rem 62.5%在chrome谷歌和其他浏览器不一样 http://www.5imoban.net/jiaocheng/div+css/201512191529.html http://blog.c ...

  8. nginx读取图片没有权限

    场景是这样的,我们项目中上传图片到linux服务器后,保存图片存储路径和网络访问路径.app中用数据库返回的 图片访问路径来访问图片(nginx通过nfs方式读取图片).但是访问不到.要手动 chmo ...

  9. Ajax中参数带有html格式的 传入后台保存【一】

    因业务需求  要讲如下编辑器中带有样式的数据传入数据库保存 第一种方法  json格式传入 $(".privilegezn_page .btn_ok").click(functio ...

  10. 安卓请求服务器js文件下载到本地,版本号就下载

    <?phpreturn array('CJ_V' => 'v0.15',) <script src="/js/reserve.js?<?=C('CJ_V')?> ...