SDUT- 2749 區域內點的個數
阿新 • • 發佈:2018-12-15
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner cin = new Scanner(System.in); int n, x1, y1, x2, y2, x, y, ans; while(cin.hasNext()) { ans = 0; n = cin.nextInt(); x1 = cin.nextInt(); y1 = cin.nextInt(); x2 = cin.nextInt(); y2 = cin.nextInt(); for(int i = 0; i < n; i++) { x = cin.nextInt(); y = cin.nextInt(); if(x > x1 && x < x2 && y > y1 && y < y2)ans++; } System.out.println(ans); } cin.close(); } }