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;
}

最新文章

  1. SpringMVC 结合HttpClient调用第三方接口实现
  2. ps还能用脚本切片?
  3. 【转】commons-lang.jar包简介
  4. RESTful Api 身份认证中的安全性设计探讨
  5. 将图片文件转换为.py文件
  6. Android性能测试工具 Emmagee
  7. PHP Predefined Interfaces 预定义接口
  8. C# 中显示实现接口
  9. node配置运行环境变量;
  10. nginx access_log 完全关闭
  11. Lua学习笔记9:多文件
  12. C# 经典入门15章 -ListView 【未附代码】
  13. Keepalived+Nginx实现高可用负载均衡集群
  14. Java线程锁,synchronized、wait、notify详解
  15. html5网页录音
  16. 【Python】函数总结
  17. Linux系统组成
  18. 1011 A+B 和 C (15 分)
  19. Android自定义View创建流程
  20. Spring Boot之HelloWorld

热门文章

  1. 浅谈Yii-admin的权限控制
  2. tensorflow中的lstm的state
  3. 【React】dva-cli建立脚手架后发现页面样式不对的问题
  4. Office文档在线预览
  5. x
  6. MongoVUE1.6.9破解启动提示System.ArgumentException: 字体“Courier New”不支持样式“Regular”
  7. 在php中使用strace、gdb、tcpdump调试工具
  8. 推荐Linux管理员不可不知十大PHP安全要点 - SCutePHP
  9. js中的日期控件My97 DatePicker---那些打酱油的日子
  10. sass基础用法