codeforces467-A水题
题目链接:http://codeforces.com/problemset/problem/467/A
1 second
256 megabytes
standard input
standard output
George has recently entered the BSUCP (Berland State University for Cool Programmers). George has a friend Alex who has also entered the university. Now they are moving into a dormitory.
George and Alex want to live in the same room. The dormitory has n rooms in total. At the moment the i-th room has pi people living in it and the room can accommodate qi people in total (pi ≤ qi). Your task is to count how many rooms has free place for both George and Alex.
The first line contains a single integer n (1 ≤ n ≤ 100) — the number of rooms.
The i-th of the next n lines contains two integers pi and qi (0 ≤ pi ≤ qi ≤ 100) — the number of people who already live in the i-th room and the room's capacity.
Print a single integer — the number of rooms where George and Alex can move in.
3
1 1
2 2
3 3
0
3
1 10
0 10
10 10
2
#include<iostream>
using namespace std; int main()
{
int n,p,q,num = ;
cin >> n;
while(n--)
{
cin >> p >> q;
if(q - p >= )
num++;
}
cout << num << endl;
return ;
}
codeforces467-A水题的更多相关文章
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)
1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 154 Solved: 112[ ...
- [poj2247] Humble Numbers (DP水题)
DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...
- gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,
1195: 相信我这是水题 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 821 Solved: 219 Description GDUT中有个风云人 ...
- BZOJ 1303 CQOI2009 中位数图 水题
1303: [CQOI2009]中位数图 Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2340 Solved: 1464[Submit][Statu ...
- 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题
B - 大还是小? Time Limit:5000MS Memory Limit:65535KB 64bit IO Format: Description 输入两个实数,判断第一个数大 ...
- ACM水题
ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...
- CF451C Predict Outcome of the Game 水题
Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...
- CF451B Sort the Array 水题
Codeforces Round #258 (Div. 2) Sort the Array B. Sort the Array time limit per test 1 second memory ...
随机推荐
- lvm调整卷大小
lvreduce -L 10240M /dev/rhel/home pvchange -xn /dev/sdb1 pvmove -i /dev/sdb1 vgreduce rhel /dev/sdb1 ...
- DNS解惑之基本概念(1)
常见问题 1.域名对应的IP地址修改完要将近一天的时间才能有效果? DNS的数据库通常是在跑在DNS服务器的内存当中的,但是我们如果临时增加一条的话其实是写到了硬盘当中,当数据库服务刷新的时候新增的新 ...
- Git分支管理(四)
一.什么是分支 分支的好处: 同时并行推进多个功能开发,提高开发效率 各个分支在开发过程中,如果某一个分支开发失败,不会对其他分支有任 何影响.失败的分支删除重新开始即可. 二.分支的操作 1. 创建 ...
- 微信小程序 - 事件 | 传递 | 冒泡
事件 常见的事件有: 类型 触发条件 最低版本 touchstart 手指触摸动作开始 touchmove 手指触摸后移动 touchcancel 手指触摸动作被打断,如来电提醒,弹窗 t ...
- ABP 异常
abp自己封装了一个异常的基类: 此异常用于直接显示给用户,可用于返回一些提示,如:密码错误,用户名不能为空等. 参数 Severity :异常的严重程度 是个Enum类型 基本使用: 系统常见异常: ...
- ASP.NET开发实战——(三)第一个ASP.NET应用《MyBlog》
本文开始通过ASP.NET MVC创建一个博客应用,该应用是通过默认的MVC模板修改而来,所以创建的过程和代码都与默认模板一致,然后通过修改的方式将默认模板改为博客的主页,并添加博客列表.内容等页面. ...
- MySQL实战45讲学习笔记:第二十一讲
一.引子 在上一篇文章中,我和你介绍了间隙锁和 next-key lock 的概念,但是并没有说明加锁规则.间隙锁的概念理解起来确实有点儿难,尤其在配合上行锁以后,很容易在判断是否会出现锁等待的问题上 ...
- Oracle RAC 修改SPFILE路径 文件查看
在spfile场景下创建pfile: SQL> create pfile='/opt/oracle/init_pfile.ora'; 创建新spfile: SQL> create spfi ...
- quartz Cron表达式生成详解
简介 Cron作为一个Unix工具,已经存在很长一段时间了,用于实现任务调度的功能.CronTrigger类基于Cron而来. CronTrigger CronTriggers往往比SimpleTri ...
- 剑指offer:对称的二叉树
题目描述: 请实现一个函数,用来判断一颗二叉树是不是对称的.注意,如果一个二叉树同此二叉树的镜像是同样的,定义其为对称的. 思路分析: 二叉树的镜像就是左右相反,对称二叉树即镜像相等.利用一个递归函数 ...