코드포스 467A (codeforces 467A)

코드포스 467A (codeforces 467A) 문제 풀이 및 코드 (description and code)

Problem - 467A - Codeforces

코드

import java.io.*;

public class CF467A {
    static int n, p, q, count = 0;
    static String ins[];
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        n = Integer.parseInt(br.readLine());
        for (int i = 0; i < n; i++) {
            ins = br.readLine().split(" ");
            p = Integer.parseInt(ins[0]);
            q = Integer.parseInt(ins[1]);
            if (q - p > 1) count++;
        }
        bw.write(count + "\n");
        bw.flush();bw.close();
    }
}

설명