1.Link:

http://poj.org/problem?id=3117

2.Content:

World Cup
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 8778   Accepted: 4406

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

South America 2006, Brazil Subregion

3.Method:

4.Code:

 #include <iostream>
#include <cstdio> using namespace std; int main()
{
int i;
int t,n;
int num,a;
char ch[];
while((cin>>t>>n)&&(t!=||n!=))
{
num=;
for(i=;i<t;i++)
{
scanf("%s",ch);
cin>>a;
num+=a;
}
cout<<(*n-num)<<endl;
}
//system("pause");
return ;
}

5.Reference:

Poj 3117 World Cup的更多相关文章

  1. Poj 1953 World Cup Noise之解题报告

    World Cup Noise Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 16369   Accepted: 8095 ...

  2. poj - 1953 - World Cup Noise(dp)

    题意:n位长的01序列(0 < n < 45),但不能出现连续的两个1,问序列有多少种. 题目链接:id=1953" target="_blank">h ...

  3. POJ 1953 World Cup Noise

    World Cup Noise Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 14397   Accepted: 7129 ...

  4. poj 1953 World Cup Noise (dp)

    World Cup Noise Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 16774   Accepted: 8243 ...

  5. POJ 1953 World Cup Noise(递推)

    https://vjudge.net/problem/POJ-1953 题意:输入一个n,这n位数只由0和1组成,并且不能两个1相邻.计算共有多少种排列方法. 思路:递推题. 首先a[1]=2,a[2 ...

  6. POJ 题目分类(转载)

    Log 2016-3-21 网上找的POJ分类,来源已经不清楚了.百度能百度到一大把.贴一份在博客上,鞭策自己刷题,不能偷懒!! 初期: 一.基本算法: (1)枚举. (poj1753,poj2965 ...

  7. (转)POJ题目分类

    初期:一.基本算法:     (1)枚举. (poj1753,poj2965)     (2)贪心(poj1328,poj2109,poj2586)     (3)递归和分治法.     (4)递推. ...

  8. poj分类

    初期: 一.基本算法:      (1)枚举. (poj1753,poj2965)      (2)贪心(poj1328,poj2109,poj2586)      (3)递归和分治法.      ( ...

  9. poj 题目分类(1)

    poj 题目分类 按照ac的代码长度分类(主要参考最短代码和自己写的代码) 短代码:0.01K--0.50K:中短代码:0.51K--1.00K:中等代码量:1.01K--2.00K:长代码:2.01 ...

随机推荐

  1. OA项目之左导航

    左边导航(一层级,二层级,三层级,四层级) aspx: <%@ Page Language="C#" AutoEventWireup="true" Cod ...

  2. 硬盘安装centos

    1.用pqmagic划分出来二个分区,第一个是ext3格式的,用于放centos镜像文件,第二个不用管是什么格式的,用于安装centos,我一般在磁盘最后面划分出来二个分区. 2.安装Ext2Fsd  ...

  3. javascript面向对象学习笔记——创建对象(转)

    工厂模式 该模值抽象了创建具体对象de过程.用函数来封装噫特定接口创建对象的细节. function createPerson(name,age,job){ var o=new Object(); o ...

  4. WEB服务器、应用程序服务器、HTTP服务器区别(转)

    WEB服务器.应用程序服务器.HTTP服务器有何区别?IIS.Apache.Tomcat.Weblogic.WebSphere都各属于哪种服务器,这些问题困惑了很久,今天终于梳理清楚了: Web服务器 ...

  5. Samba服务器配置参考链接

    一步一学Linux与Windows共享文件Samba(很适合初学者,极力推荐): http://os.51cto.com/art/200709/56395.htm 由最简单的一个例子说起,匿名用户可读 ...

  6. ASP.NET 去除所有HTML标记的方法

    using System.Text.RegularExpressions /// <summary> /// 去除HTML标记 /// </summary> /// <p ...

  7. [课程相关]homework-02

    一.如何组织代码 因为这个代码比较简单,用函数就足够了,个人觉得没必要用类,杀鸡不必用牛刀. 代码有点长,主要是加了很多判断参数的部分. 提取了一个公共的递归函数. 用了不少全局变量,可能当做参数传入 ...

  8. InvocationTargetException

    在使用反射的适合,调用的方法无论抛出什么异常,都会变成InvocationTargetException,要想得到原始的异常,必须使用getTargetException()

  9. 历经曲折的freescale

    从来没有想到自己在大学最信任的队友会突然放弃,,为了这个,,我可以说放弃了很多,,这几天可以我也不知道怎么办了,,我想不通的是为什么可以这样,为什么可以这么不负责任,,为什么这么自私,,这些我永远都不 ...

  10. bash下自动重新运行git/curl等工具

    在使用诸如git/curl等工具的时候,如果网络状况不佳,经常会产生出错中断的情况,于是我们就会发现晚上挂机的下载一些代码和工具包,早上再看已经中断. 为应对这种情况我们需要判断下载工具的运行结果,如 ...