题目链接: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. C语言结构体(摘抄C语言设计)

    struct Student stu_1;//定义struct Student 类型的变量stu_1 struct Student *p;//定义指向struct Student类型数据的指针变量 p ...

  2. E06 【买衣服】Maybe you need a bigger size

    核心句型 Maybe you need a bigger size 也许您需要大一些的. 场景对话 A:Can I try this jacket on,please? 我能试试这件夹克吗? B:Su ...

  3. JWT 使用的另一种声音

    讲真,别再使用JWT了! 把本应该session 中保存的数据 去除敏感字段 保留到客户端   在Web应用中,使用JWT替代session并不是个好主意 适合JWT的使用场景 抱歉,当了回标题党.我 ...

  4. 重新学习SpringMVC——基础

    2. SpringMVC_HelloWorld3. SpringMVC_RequestMapping_修饰类4. SpringMVC_RequestMapping_请求方式5. SpringMVC_R ...

  5. JDOJ 1927 求逆序对

    洛谷 P1908 逆序对 洛谷传送门 JDOJ 1927: 求逆序对 JDOJ传送门 题目描述 猫猫TOM和小老鼠JERRY最近又较量上了,但是毕竟都是成年人,他们已经不喜欢再玩那种你追我赶的游戏,现 ...

  6. Python进阶-Ⅷ 匿名函数 lambda

    1.匿名函数的引入 为了解决那些功能很简单的需求而设计的一句话函数 def func(i): return 2*i # 简化之后 func = lambda i:2*i #todo 其中:func是函 ...

  7. Jike_Time

    数据分析全景图 1. 数据采集.它是我们的原材料,也是最“接地气”的部分,因为任何分析都要有数据源. 2. 数据挖掘.它可以说是最“高大上”的部分,也是整个商业价值所在.之所以要进行数据分析,就是要找 ...

  8. set去重应用

    1.其中涉及__hash__与__eq__这两个内置方法. 2.列如: 要求用类生成多个对象,其中姓名和性别相同的对象可认为是同一个人,用set原理做去重 class People: def __in ...

  9. B1020 月饼(25分)

    #include<cstdio> #include<algorithm> #include<iostream> using namespace std; struc ...

  10. Zabbix介绍及安装

    Zabbix简介 Zabbix是一款能够监控各种网络参数以及服务器健康性和完整性的软件,是一个企业级的分布式开源监控方案.Zabbix使用灵活的通知机制,允许用户为几乎任何事件配置基于邮件的告警.这样 ...