题目链接: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. 解决在linux下编译32程序出现“/usr/include/gnu/stubs.h:7:27: 致命错误:gnu/stubs-32.h:没有那个文件或目录问题”

    centos64位编译32位代码,出现/usr/include/gnu/stubs.h:7:27: 致命错误:gnu/stubs-32.h:没有那个文件或目录,需要安装32位的glibc库文件. 安装 ...

  2. c# 第二节 c#的常用IDE环境

    本节内容: 1:常用ide环境 2:Visual Studio 简介 3:Visual Studio Express简介 4:Sharp Develop 5:  IDE 与 .Net的版本 1:常用i ...

  3. nginx源码安装与使用

    [root@localhost ~]# yum -y install pcre-devel zlib-devel openssl openssl-devel gcc* [root@localhost ...

  4. git push origin master错误

    以下错误是因为远程有的文件,本地没有,故而无法push文件到远程 $ git push origin master To git@github.com:AntonioSu/learngitWindow ...

  5. zookeeper 链接报错 KeeperErrorCode = NodeExists for

    zookeeper  链接报错 CONNECTING Receive watched event:WatchedEvent state:SyncConnected type:None path:nul ...

  6. Linux服务器惨遭挖矿

      昨天为了协助客户测试业务,帮客户开通了一台云主机,因为是测试环境所以密码设置的很简单:1qaz@WSX,今天登陆的是否发现密码认证不通过了,确定机器是被黑掉了,估计多半是被国外小哥入侵挖矿了,记录 ...

  7. JS通过指定大小来压缩图片

    安装: npm i image-conversion --save 引入: <script src="https://cdn.jsdelivr.net/gh/WangYuLue/ima ...

  8. 使用IDEA+vue.js+easyUI的demo

    最近,随便写了几个开发的小例子,自己总结下,留个纪念. 例子1:使用EasyUI做了一个简单界面,服务器和客户端在一起. @Controller @RequestMapping("/demo ...

  9. 实现100以内的素数输出(Python与C++对比)

    今天从链接http://www.2cto.com/kf/201302/187699.html中看到了Python实现100以内的素数输出的算法,颇受感触.尤其是被其中的Python的列表生成器的使用方 ...

  10. bootstarp treeview 获取勾选和获取Selected选中

    在用treeview的时候,经常会遇到一些官网没有详细说明的东西,比如获取勾选和获取选中的方法,获取选中官网是有明显说明的, 如下 : $('#resourceTree').treeview('get ...