The Solution of UESTC 2016 Summer Training #1 Div.2 Problem C
Link
http://acm.hust.edu.cn/vjudge/contest/121539#problem/C
Description
After a long ACM training day, Master Hasan invited his trainees for a light dinner in the cafeteria. The cafeteria has N tables, each with a number of chairs around it. Before accepting the trainees into the cafeteria, Master Hasan wants to know how many unused chairs are there in the cafeteria. If there isn't enough chairs, he might invite them to a well-known Indian restaurant.
Input
The first line of input contains a single integer N(1 ≤ N ≤ 100), the number of tables in the cafeteria.
Each of the following N lines contains two integers describing a table, A and B(1 ≤ A ≤ B ≤ 100), where A represents the number of used chairs, and B represents the total number of chairs around that table.
Output
Print the number of unused chairs in the cafeteria.
Sample Input
3
1 3
4 4
5 8
5
#include<iostream>
using namespace std;
int main()
{
int n,a,b,sum;
cin>>n;sum=0;
while(n--)
{
cin>>a>>b;
sum+=b-a;
}
cout<<sum<<endl;
return 0;
}
The Solution of UESTC 2016 Summer Training #1 Div.2 Problem C的更多相关文章
- The Solution of UESTC 2016 Summer Training #1 Div.2 Problem B
Link http://acm.hust.edu.cn/vjudge/contest/121539#problem/B Description standard input/output Althou ...
- The Solution of UESTC 2016 Summer Training #1 Div.2 Problem A
Link http://acm.hust.edu.cn/vjudge/contest/121539#problem/A Description standard input/output Haneen ...
- UESTC 2016 Summer Training #6 Div.2
我好菜啊.. UVALive 6434 给出 n 个数,分成m组,每组的价值为最大值减去最小值,每组至少有1个,如果这一组只有一个数的话,价值为0 问 最小的价值是多少 dp[i][j] 表示将 前 ...
- UESTC 2016 Summer Training #1 Div.2
最近意志力好飘摇..不知道坚不坚持得下去.. 这么弱还瞎纠结...可以滚了.. 水题都不会做.. LCS (A) 水 LCS (B) 没有看题 Gym 100989C 水 1D Cafeteria ( ...
- UESTC 2016 Summer Training #1 J - Objects Panel (A) 按条件遍历树
#include <iostream> #include <cstdio> #include <vector> using namespace std; typed ...
- 2016 Multi-University Training Contests
2016 Multi-University Training Contest 1 2016 Multi-University Training Contest 2 2016 Multi-Univers ...
- 2016 Multi-University Training Contest 2 D. Differencia
Differencia Time Limit: 10000/10000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Tot ...
- 2016 Multi-University Training Contest 1 G. Rigid Frameworks
Rigid Frameworks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- 2016 Multi-University Training Contest 1
8/11 2016 Multi-University Training Contest 1 官方题解 老年选手历险记 最小生成树+线性期望 A Abandoned country(BH) 题意: 1. ...
随机推荐
- 安装VS2015历险记
最近,因为一些需求,需要在家里的笔记本上安装VS2015.本来以为一件很容易的一件事,发现做起来遇到了很多坑. 首先,下载VS2015,这就花费了两三个小时,安装包太大了.下载完,安装.安装不成功,报 ...
- C语言 遍历流程 变量生命周期
来自c程序设计 谭浩强 程序编译流程 运行c程序的步骤 在编好一个c程序后.怎样上机进行编译运行呢?一般要经过一下几个步骤: 上机输入和编辑源程序.通过键盘和计算机输入程序,如果发现有错误,要及时改正 ...
- plsql配置远程连接数据库
1.先安装plsql.地址:http://pan.baidu.com/s/1hqGbATI 2. 解压缩 instantclient_11_2(这个客户端可以在网上找精简版的),找到以下路径 \i ...
- yum 源
epel 6源: cd /usr/local/src wget https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noar ...
- 常用命令[Linux]
Linux文件类型 -:普通文件(f) d:目录文件 b:块设备文件(block) c:字符设备文件(character) l:符号链接文件(symbolic link file) p:命名管道文件( ...
- Cocos2d-x 生成真正的随机数
关于随机数 cocos2d-x 定义了一个宏 CCRANDOM_0_1 生成的是 [0, 1] 之间的值 因此,要生成 [0-100] 之间的数 CCRANDOM_0_1 * 100 生成 [ ...
- ROS学习(三)—— ROS文件系统
一.预备工作 使用ros0tutorials程序包,先下载: sudo apt-get install ros-<distro>-ros-tutorials 其中<distro> ...
- Redis 数据库入门指南
Redis 是一个开源数据库,它使用内存数据结构存储,可作为数据库.缓存和消息代理使用.Redis 支持丰富的数据结构,有:字符串(Strings).哈希(Hashs).列表(Lists).集合(Se ...
- 将jsp页面转化为图片或pdf(一)
在项目中遇见了将jsp页面转化为pdf的问题,试过itext,但是itext需要标准的html代码,我的页面中的一些属性是itext所不识别的,所以努力了一段时间后就放弃了,后来发现htmlutil抓 ...
- Cookie 用法 小记
//保存cookie Cookie cookieName = new Cookie("name", realUser.getName()); Coo ...