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. php+mysql 内联接 和 子查询

    INNER JOIN(内连接):取得两个表中存在连接匹配关系的记录 $sql="SELECT * FROM subject as a INNER JOIN e_user as b ON a. ...

  2. css display属性介绍

    none此元素不会被显示. block此元素将显示为块级元素,此元素前后会带有换行符. inline默认.此元素会被显示为内联元素,元素前后没有换行符. inline-block行内块元素.(CSS2 ...

  3. java中多态的使用

    一.动手动脑 public class ParentChildTest { public static void main(String[] args) { Parent parent=new Par ...

  4. linux中fork()函数详解(转)

    转自:http://blog.csdn.net/jason314/article/details/5640969 一.fork入门知识 一个进程,包括代码.数据和分配给进程的资源.fork()函数通过 ...

  5. 真实代理(RealProxy)在WCF中的运用

    在WCF中,当我们在调用服务端的方法时,一般有两点需要考虑:1.捕获服务端的异常信息,记录日志:2.及时关闭会话信道,当调用超时或调用失败时及时中断会话信道.我们一般会像下面这样处理(以Calcula ...

  6. 1、File类的API

    通过Api我们可知,File类是java一个内置类,被封装到java.io.jar包中 其构造方法有一下3种 其方法常用的有以下几种

  7. 《JS权威指南学习总结--6.3删除属性》

    内容要点: 一.delete运算符可以删除对象的属性.它的操作数应当是一个属性访问表达式.让人感到意外的是,delete只是断开属性和宿主对象的联系,而不会去操作属性中的属性: delete book ...

  8. JS复习:第十、十一章

    第十章 NodeList是一种类数组对象,用于保存一组有序的节点,可以通过位置来访问这些节点,但它并不是Array实例,将其转化为数组的方法: function converToArray(nodes ...

  9. js提交form表单

    <form action="/Enterprise/member" id="sendinviteid" method="post"&g ...

  10. 屏幕坐标和世界坐标的转换+对象池技术(3D打地鼠小游戏)

    游戏中可能经常会遇到需要某个物体跟着鼠标移动,然后又需要把物体放在某个鼠标指定的位置 实现方式 Camera.main.WorldToScreenPoint Camera.main.ScreenToW ...