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;
}
最新文章
- SpringMVC 结合HttpClient调用第三方接口实现
- ps还能用脚本切片?
- 【转】commons-lang.jar包简介
- RESTful Api 身份认证中的安全性设计探讨
- 将图片文件转换为.py文件
- Android性能测试工具 Emmagee
- PHP Predefined Interfaces 预定义接口
- C# 中显示实现接口
- node配置运行环境变量;
- nginx access_log 完全关闭
- Lua学习笔记9:多文件
- C# 经典入门15章 -ListView 【未附代码】
- Keepalived+Nginx实现高可用负载均衡集群
- Java线程锁,synchronized、wait、notify详解
- html5网页录音
- 【Python】函数总结
- Linux系统组成
- 1011 A+B 和 C (15 分)
- Android自定义View创建流程
- Spring Boot之HelloWorld
热门文章
- 浅谈Yii-admin的权限控制
- tensorflow中的lstm的state
- 【React】dva-cli建立脚手架后发现页面样式不对的问题
- Office文档在线预览
- x
- MongoVUE1.6.9破解启动提示System.ArgumentException: 字体“Courier New”不支持样式“Regular”
- 在php中使用strace、gdb、tcpdump调试工具
- 推荐Linux管理员不可不知十大PHP安全要点 - SCutePHP
- js中的日期控件My97 DatePicker---那些打酱油的日子
- sass基础用法