CF467A.George and Accommodation
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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 p__i people living in it and the room can accommodate q__i people in total (p__i ≤ q__i). Your task is to count how many rooms has free place for both George and Alex.
乔治最近进入了BSUCP(伯兰德酷程序员国立大学)。他的朋友亚历克斯也进入了这所大学。现在他们正要搬进宿舍。
乔治和亚历克斯希望住在同一间房间。宿舍共有 n 间房间。目前第 i 间房间已有 pi 人入住,而该房间总共可容纳 qi 人(满足 pi≤qi)。你的任务是计算有多少间房间还至少空余两个床位,足以同时容纳乔治和亚历克斯。
输入格式
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 p__i and q__i (0 ≤ p__i ≤ q__i ≤ 100) — the number of people who already live in the i-th room and the room's capacity.
第一行包含一个整数 n(1≤n≤100)—— 房间的数量。
接下来的 n 行中,第 i 行包含两个整数 pi 和 qi(0≤pi≤qi≤100)—— 分别表示第 i 个房间中已居住的人数以及该房间的容量。
输出格式
Print a single integer — the number of rooms where George and Alex can move in.
输出一个整数——乔治和亚历克斯可以入住的房间数量。
输入输出样例
输入#1
3 1 1 2 2 3 3
输出#1
0
输入#2
3 1 10 0 10 10 10
输出#2
2
输入解题思路,AI测评打分。不知道怎么写?