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 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的更多相关文章
- 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 ...
随机推荐
- [Angular 2] Create Shareable Angular 2 Components
Components that you use across multiple applications need to follow a module pattern that keeps them ...
- 根据Entity Framework6.X 数据生成代码(仅获取表名)
近来学习ASP.NET MVC ,一直在看韩迎龙(Kencery)的ASP.NET MVC+EF框架+EasyUI实现权限管理.在第九节(TT模板的学习)卡住了,作者使用EF5.0做数据源,而我使用的 ...
- PAT 1004
1004. Counting Leaves (30) A family hierarchy is usually presented by a pedigree tree. Your job is t ...
- memcahced 更新
memcahc特性: 在 Memcached中可以保存的item数据量是没有限制的,只要内存足够 . Memcached单进程在32位系统中最大使用内存为2G,若在64位系统则没有限制,这是由于32位 ...
- 利用mmap /dev/mem 读写Linux内存
转载:http://blog.csdn.net/zhanglei4214/article/details/6653568 使用 hexedit /dev/mem 可以显示所有物理内存中的信息. 运用m ...
- PHP.3-DIV+CSS标准网页布局准备工作(上)
DIV+CSS标准网页布局准备工作(上) 概述 使用"DIV+CSS"对网站进行布局符合W3C标准,采用这种方式布局通常是为了说明与HTML表格定位方式的区别.因为现在的网站设计标 ...
- 电商平台如何接入快递鸟电子面单API?
快递鸟是全球物流接口服务商,为电商 ERP.电商平台.仓储.清关公司提供物流跟踪.电子面单.智选物流.物流金融.在线下单等服务,解决电商的物流管理模块和金融模块.现就对快递鸟电子面单API做基本描述, ...
- 数据结构笔记02:Java面试必问算法题
1. 面试的时候,栈和队列经常会成对出现来考察.本文包含栈和队列的如下考试内容: (1)栈的创建 (2)队列的创建 (3)两个栈实现一个队列 (4)两个队列实现一个栈 (5)设计含最小函数min()的 ...
- Debian 7.4 中配置PHP环境
准备工作 导入密钥 wget http://www.dotdeb.org/dotdeb.gpg sudo apt-key add dotdeb.gpg 添加源 vi /etc/apt/sources. ...
- 打印W图案
一:规律 二维图形的展示都可以使用二维数组来解决,W图形x轴0,1,2,1,0,1,2.....在0到2直接来回的徘徊 y轴是在一直递增........ 二:代码 @Test /** * 测试打印w图 ...