Link

http://acm.hust.edu.cn/vjudge/contest/121539#problem/C

Description

standard input/output

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

Input
3
1 3
4 4
5 8
Output
5
Solution
This problem is a piece of cake.The number of unused chair of each table is B-A,and our task is to sum them up.
C++ Code

#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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. UESTC 2016 Summer Training #6 Div.2

    我好菜啊.. UVALive 6434 给出 n 个数,分成m组,每组的价值为最大值减去最小值,每组至少有1个,如果这一组只有一个数的话,价值为0 问 最小的价值是多少 dp[i][j] 表示将 前 ...

  4. UESTC 2016 Summer Training #1 Div.2

    最近意志力好飘摇..不知道坚不坚持得下去.. 这么弱还瞎纠结...可以滚了.. 水题都不会做.. LCS (A) 水 LCS (B) 没有看题 Gym 100989C 水 1D Cafeteria ( ...

  5. UESTC 2016 Summer Training #1 J - Objects Panel (A) 按条件遍历树

    #include <iostream> #include <cstdio> #include <vector> using namespace std; typed ...

  6. 2016 Multi-University Training Contests

    2016 Multi-University Training Contest 1 2016 Multi-University Training Contest 2 2016 Multi-Univers ...

  7. 2016 Multi-University Training Contest 2 D. Differencia

    Differencia Time Limit: 10000/10000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Tot ...

  8. 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) ...

  9. 2016 Multi-University Training Contest 1

    8/11 2016 Multi-University Training Contest 1 官方题解 老年选手历险记 最小生成树+线性期望 A Abandoned country(BH) 题意: 1. ...

随机推荐

  1. Linux下的DOS攻击

    Linux下的DOS攻击 DOS是Denial of service的简称,即拒绝服务,造成Dos攻击行为被称为Dos攻击,其目的是使计算机或网络无法提供正常的服务.最常见的Dos攻击有计算机带宽攻击 ...

  2. C# List<T> 合并、去重、查找

    List<,,,,,}; List<,,,,}; listA.AddRange(listB );//把集合A.B合并 List<int> Result = listA.Unio ...

  3. 104-switch语句读法:

  4. Android使用CountDownTimer倒计时

    1.布局文件 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android ...

  5. Android学习杂记

    Jni接口学习资料: http://www.cnblogs.com/lsnproj/archive/2012/01/09/2317519.html classLoader和插件化: http://bl ...

  6. Html和CSS布局技巧

    单列布局水平居中 水平居中的页面布局中最为常见的一种布局形式,多出现于标题,以及内容区域的组织形式,下面介绍四种实现水平居中的方法(注:下面各个实例中实现的是child元素的对齐操作,child元素的 ...

  7. Flashback Data Archive ( Oracle Total Recall ) introduced in 11g

    Flashback Data Archive feature is part of Oracle Total Recall technology. Flashback Data Archive fea ...

  8. UWP学习记录3-设计和UI之样式

    UWP学习记录3-设计和UI之样式 1.颜色 在系统的“设置”>“个性化”>“颜色”里,提供了主题色选择.选定主题色后,会根据颜色亮度的 HSB 值创建浅色和深色的主题色. 应用可使用阴影 ...

  9. c语言快速入门3

    如果你想快速入门计算机,可以参考我的上一篇帖子,先了解一些必备的软知识,然后再来进行语言的快速入门 计算机入门基础知识 c语言快速入门1 c语言快速入门2 3.4.1 字符和字符串 字符:'' 单个  ...

  10. Axure RP = Axure Rapid Prototyping

    不要一味追求高保真,特别是交互后产生动态数据.并且将动态数据交互传递出去,违背了做原型的初衷了. 自己做着玩追求高保真可以,有成就感. 但作为工作的话,效率优先.能简单直观地展示必要的交互效果即可.