题目链接:http://codeforces.com/problemset/problem/467/A

A. George and Accommodation
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

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.

Input

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.

Output

Print a single integer — the number of rooms where George and Alex can move in.

Examples
input

Copy
3
1 1
2 2
3 3
output

Copy
0
input

Copy
3
1 10
0 10
10 10
output

Copy
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水题的更多相关文章

  1. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  2. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  3. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

  4. [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 ...

  5. gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,

    1195: 相信我这是水题 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 821  Solved: 219 Description GDUT中有个风云人 ...

  6. BZOJ 1303 CQOI2009 中位数图 水题

    1303: [CQOI2009]中位数图 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 2340  Solved: 1464[Submit][Statu ...

  7. 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题

    B - 大还是小? Time Limit:5000MS     Memory Limit:65535KB     64bit IO Format: Description 输入两个实数,判断第一个数大 ...

  8. ACM水题

    ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...

  9. CF451C Predict Outcome of the Game 水题

    Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...

  10. CF451B Sort the Array 水题

    Codeforces Round #258 (Div. 2) Sort the Array B. Sort the Array time limit per test 1 second memory ...

随机推荐

  1. JS高阶---定时器相关

    首先看几个问题: [主体] (1)定时器真的时定时执行的吗? 顺序验证: 测试结果: 接下来对上述代码做下修改,增加一个长时间工作的消耗,此时再来验证下定时器运行的精准度 结果如下: (2)定时器回调 ...

  2. 201871010124--王生涛--《面向对象程序设计(java)》第十二周学习总结

    博文正文开头格式: 项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://www.cnblogs.com/nw ...

  3. Python 包:

    分享一波油藏描述方面的Python开源包 前一阵去捷克参加了数学地质年会(IAMG2018),听完汇报,发现在数学地质领域用python的越来越多了,他们的很多成果都是用python做出来的.不管喜不 ...

  4. 团队冲刺---Four

    今天的计划: 研究css模板. 昨天做了什么: 寻找css模板,研究界面布局. 遇到的问题: css模板,代码看不太懂,好多标签都不会用.

  5. 系统监控工具glances

      glances是一款由python开发的系统监控工具,可以实时查看CPU.内存.网络.IO.进程.磁盘空间使用率的使用情况,并且支持三种运行模式,个人感觉比top命令使用更便捷: 安装glance ...

  6. C++面向对象程序设计学习笔记(3)

    类与对象(1) 结构体与类 结构体的扩充 C++对结构体进行了扩充,它不仅可以含有不同类型的数据,还可以含有函数,结构体的函数可以像访问结构体中的数据一样进行访问. 类的声明 声明类的方法与声明结构体 ...

  7. leetcode组合总和 Ⅳ 解题路径

    题目: 关于动态规划类题目的思路如何找在上一篇博客 https://www.cnblogs.com/niuyourou/p/11964842.html 讲的非常清楚了,该博客也成为了了leetcode ...

  8. cnpm包管理

    C:\Users\Administrator>npm config set registry http://registry.npm.taobao.org vue 安装 npm install ...

  9. Python __name__的使用

    __name__是什么 * __开头代表是系统变量; * __name__ 是标识模块名字的系统变量. 当前模块是主模块时, 模块名就是"__main__"; 当模块是被调用(im ...

  10. Github库名命名规范

    必要性说明 由于迁移到Github上的项目越来越多,对项目的管理越来越困难.由于各项目命名具有随意性,用之代表git仓库名后就很难快速回忆起这个项目的相关细节,通常需要不断打开某个库才能有所了解.因此 ...