cf467A George and Accommodation
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
sb题
判断qi-2>=pi的有多少个
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int n,m;
int main()
{
scanf("%d",&n);
int x,y;
for(int i=1;i<=n;i++)
{
scanf("%d%d",&x,&y);
if(y-x>=2)m++;
}
printf("%d",m);
return 0;
}
cf467A George and Accommodation的更多相关文章
- A - George and Accommodation
Problem description George has recently entered the BSUCP (Berland State University for Cool Program ...
- CF467 AB 水题
Codeforces Round #267 (Div. 2) (C和D的题解单独写:CF467C George and Job (DP) CF467D Fedor and Essay 建图DFS) C ...
- Codeforces Round #267 (Div. 2) A
题目: A. George and Accommodation time limit per test 1 second memory limit per test 256 megabytes inp ...
- codeforces467-A水题
题目链接:http://codeforces.com/problemset/problem/467/A A. George and Accommodation time limit per test ...
- CF467C George and Job (DP)
Codeforces Round #267 (Div. 2) C. George and Job time limit per test 1 second memory limit per test ...
- 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 ...
- Codeforces 467C George and Job(DP)
题目 Source http://codeforces.com/contest/467/problem/C Description The new ITone 6 has been released ...
- Codeforces Round #267 (Div. 2) C. George and Job DP
C. George and Job The new ITone 6 has been released ...
- HDU 4118 Holiday's Accommodation
Holiday's Accommodation Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 200000/200000 K (Jav ...
随机推荐
- LeetCode_Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...
- CSS之清除浮动
一.清除浮动的目的. 1.当一个父元素的高度不写或为auto时,而且这个父元素内又有浮动的子元素,那么这时候该父元素的高度将不会自动适应子元素的高度,也可以说高度是0px; 有如下代码: <di ...
- SQL Server 索引的图形界面操作 <第十二篇>
一.索引的图形界面操作 SQL Server非常强大的就是图形界面操作.关于索引方面也一样那么强大,很多操作比如说重建索引啊,查看各种统计信息啊,都能够通过图形界面快速查看和操作,下面来看看SQL S ...
- MongoDB基本命令随便敲敲
1,mongoDB状态,版本,当前连接的数据库名称
- nc命令 (NetCat)
摘自http://www.68idc.cn/help/server/linux/2014040682705.html NetCat,在网络工具中有"瑞士军刀"美誉,其有Window ...
- Phoenix中Sequence的用法
Phoenix--HBase的JDBC驱动 序列(Sequence)是Phoenix提供的允许产生单调递增数字的一个SQL特性,序列会自动生成顺序递增的序列号,以实现自动提供唯一的主键值. 使用C ...
- Hard Process(二分)
Hard Process Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submi ...
- 委托、Lambda表达式
本文来自:http://wenku.baidu.com/link?url=o9Xacr4tYocCPhivayRQXfIc9kOZeWBwPn2FZfeF19P4-8YX5CMXs74WB-Y8t0S ...
- Hadoop中SequenceFile的使用
1.对于某些应用而言,须要特殊的数据结构来存储自己的数据. 对于基于MapReduce的数据处理.将每一个二进制数据的大对象融入自己的文件里并不能实现非常高的可扩展性,针对上述情况,Hadoop开发了 ...
- 对于IE6及以下版本的处
判断IE6 CSS 通过判断浏览器类型而加载不同的css样式 所有的IE都起作用: <!--[if IE]> <link rel="stylesheet" typ ...