Description
有
n
个房间,第
Input
第一行一整数
n
表示房间数,之后
Output
输出还可以再住两人的房间数
Sample Input
3
1 1
2 2
3 3
Sample Output
0
Solution
水题,统计 qi−pi≥2 的个数即可
Code
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int INF=0x3f3f3f3f,maxn=100001;
int main()
{
int n,p,q;
while(~scanf("%d",&n))
{
int ans=0;
while(n--)
{
scanf("%d%d",&p,&q);
if(q-p>=2)ans++;
}
printf("%d\n",ans);
}
return 0;
}