Thursday, February 5, 2015

Solution of 467A. George and Accommodation (Codeforces)



#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define sf scanf
#define pf printf
typedef long long ll;

int main()
{
    int n, p, q, seat;
    sf("%d", &n);
    int count = 0;
    while(n--)
    {
        sf("%d%d", &p, &q);
        seat = (q-p);
        if(seat>=2)
        {
            count++;
        }
    }
    pf("%d\n", count);
}

No comments:

Post a Comment

Compare equality of two string in C

#include <stdio.h> #include<string.h> int main() {     char* country = "Bangladesh";     char* country2;     ...