Problem description

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

3
1 1
2 2
3 3

Output

0

Input

3
1 10
0 10
10 10

Output

2
解题思路:统计房间内剩余人数不小于2的房间总数(两个人住在同一间),水过!
AC代码:
 #include<bits/stdc++.h>
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 ;
}

A - George and Accommodation的更多相关文章

  1. cf467A George and Accommodation

    A. George and Accommodation time limit per test 1 second memory limit per test 256 megabytes input s ...

  2. CF467 AB 水题

    Codeforces Round #267 (Div. 2) (C和D的题解单独写:CF467C George and Job (DP) CF467D Fedor and Essay 建图DFS) C ...

  3. Codeforces Round #267 (Div. 2) A

    题目: A. George and Accommodation time limit per test 1 second memory limit per test 256 megabytes inp ...

  4. codeforces467-A水题

    题目链接:http://codeforces.com/problemset/problem/467/A A. George and Accommodation time limit per test ...

  5. CF467C George and Job (DP)

    Codeforces Round #267 (Div. 2) C. George and Job time limit per test 1 second memory limit per test ...

  6. Codeforces Round #227 (Div. 2) E. George and Cards set内二分+树状数组

    E. George and Cards   George is a cat, so he loves playing very much. Vitaly put n cards in a row in ...

  7. Codeforces 467C George and Job(DP)

    题目 Source http://codeforces.com/contest/467/problem/C Description The new ITone 6 has been released ...

  8. Codeforces Round #267 (Div. 2) C. George and Job DP

                                                  C. George and Job   The new ITone 6 has been released ...

  9. HDU 4118 Holiday's Accommodation

    Holiday's Accommodation Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 200000/200000 K (Jav ...

随机推荐

  1. veket智能机器人

    官方网站:http://www.lucky8k.com/forum.php veket儿童操作系统 希望工具超过小puppy linux系统 一个还在发展中的linux系统: Slax Linux : ...

  2. .NET Core & EntityFrameworkCore

    前言 .NET Core 相比于 .NET Fromework 有跨平台.轻量化且开源的优势. 在使用 EntityFrameworkCore 的时候也遇到了很多问题,至于网络上的教程嘛...大部分都 ...

  3. boost asio异步读写网络聊天程序客户端 实例详解

    boost官方文档中聊天程序实例讲解 数据包格式chat_message.hpp <pre name="code" class="cpp">< ...

  4. day007 列表类型、元祖类型、 字典类型、 集合类型的内置方法

    目录 列表数据类型的内置方法 作用 定义方式 优先掌握的方法 需要掌握的方法 元祖类型的内置方法 作用 定义方式 优先掌握的方法(参考列表方法) 字典类型的内置方法 作用 定义方式 优先掌握的方法 需 ...

  5. PAT_A1154#Vertex Coloring

    Source: PAT A 1154 Vertex Coloring (25 分) Description: A proper vertex coloring is a labeling of the ...

  6. Selenium3+python自动化 -JS处理滚动条

    selenium并不是万能的,有时候页面上操作无法实现的,这时候就需要借助JS来完成了. 常见场景: 当页面上的元素超过一屏后,想操作屏幕下方的元素,是不能直接定位到,会报元素不可见的. 这时候需要借 ...

  7. 10.使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件(转)

    出处:http://www.cnblogs.com/lichenwei/p/4145696.html Mybatis属于半自动ORM,在使用这个框架中,工作量最大的就是书写Mapping的映射文件,由 ...

  8. string.Format 格式化日期格式

    DateTime dt = DateTime.Now;//2010年10月4日 17点05分            string str = "";            //st ...

  9. hashlib模块 简单了解

    import hashlib '''不可逆加密''' password = 'wwwwww7777'.encode('utf8') word = hashlib.md5(password) # md5 ...

  10. 0227浅谈MySQL之 Handler_read_*参数

    转自博客http://www.path8.net/tn/archives/5613 1.监控语法: 在MySQL里,使用SHOW STATUS查询服务器状态,语法一般来说如下: SHOW [GLOBA ...