现在的位置: 首页 > 综合 > 正文

Codeforces 467A George and Accommodation(水题)

2019年08月20日 ⁄ 综合 ⁄ 共 296字 ⁄ 字号 评论关闭

题目链接:Codeforces 467A George and Accommodation

题目大意:给定n个房间的情况,pi表示已经住了pi个人,qi表示房间最多能住的人数。计算有多少个房间还能再住两个人。

解题思路:水。。

#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int main () {
    int n, c = 0, p, q;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d%d", &p, &q);
        if (q - p >= 2) c++;
    }
    printf("%d\n", c);
    return 0;
}

抱歉!评论已关闭.