Poj 3117 World Cup
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 0Sample Output
0
2Source
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的更多相关文章
- Poj 1953 World Cup Noise之解题报告
World Cup Noise Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 16369 Accepted: 8095 ...
- poj - 1953 - World Cup Noise(dp)
题意:n位长的01序列(0 < n < 45),但不能出现连续的两个1,问序列有多少种. 题目链接:id=1953" target="_blank">h ...
- POJ 1953 World Cup Noise
World Cup Noise Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 14397 Accepted: 7129 ...
- poj 1953 World Cup Noise (dp)
World Cup Noise Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 16774 Accepted: 8243 ...
- POJ 1953 World Cup Noise(递推)
https://vjudge.net/problem/POJ-1953 题意:输入一个n,这n位数只由0和1组成,并且不能两个1相邻.计算共有多少种排列方法. 思路:递推题. 首先a[1]=2,a[2 ...
- POJ 题目分类(转载)
Log 2016-3-21 网上找的POJ分类,来源已经不清楚了.百度能百度到一大把.贴一份在博客上,鞭策自己刷题,不能偷懒!! 初期: 一.基本算法: (1)枚举. (poj1753,poj2965 ...
- (转)POJ题目分类
初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. ...
- poj分类
初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. ( ...
- poj 题目分类(1)
poj 题目分类 按照ac的代码长度分类(主要参考最短代码和自己写的代码) 短代码:0.01K--0.50K:中短代码:0.51K--1.00K:中等代码量:1.01K--2.00K:长代码:2.01 ...
随机推荐
- 解析“extern”
解析“extern” 1. 声明外部变量 现代编译器一般採用按文件编译的方式,因此在编译时,各个文件里定义的全局变量是 互相透明的,也就是说,在编译时,全局变量的可见域限制在文件内部.以下举一个简单的 ...
- grunt自动化工具
Grunt和 Grunt 插件是通过 npm 安装并管理的,npm是 Node.js 的包管理器. 安装 CLI 首先,需要先将Grunt命令行(CLI)安装到全局环境中. npm install - ...
- online ddl 使用、测试及关键函数栈
[MySQL 5.6] MySQL 5.6 online ddl 使用.测试及关键函数栈 http://mysqllover.com/?p=547 本文主要分为三个部分,第一部分是看文档时的笔记:第 ...
- leetcode -- Search for a Range (TODO)
Given a sorted array of integers, find the starting and ending position of a given target value. You ...
- PHP.1-网站开发概述
网站开发概述 网站开发从本质来说,就是软件开发 1.B/S软件体系统结构 BS:浏览器与服务器的结构[降低客户端电脑的负荷,减轻维护成本,对CS的改进,可随时随地进行业务处理] #对美工要求比较高,注 ...
- DataTable转换为Model实体对象
记得在学校的时候,接触得最多的就是SqlHelper,每次在读取的时候不管是DataTable还是DataReader转换为实体对象的时候是最恼火的,因为要写很多代码,而且没有什么意义.后面接触到了反 ...
- android源码编译常见错误
错误1:You are attempting to build on a 32-bit system. Only 64-bit build environments are supported bey ...
- AVL树的插入操作(旋转)图解
=================================================================== AVL树的概念 在说AVL树的概念之前,我们需要清楚 ...
- Oracle中exists与in的区别
有两个简单例子,以说明 "exists"和"in"的效率问题 1) select * from T1 where exists(select 1 from T2 ...
- 【基础数学知识】UVa 11314 - Hardly Hard
Problem H HARDLY HARD You have been given the task of cutting out a quadrilateral slice of cake out ...