-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1358.cpp
More file actions
38 lines (33 loc) · 927 Bytes
/
1358.cpp
File metadata and controls
38 lines (33 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int width;
int height;
int x;
int y;
int n;
int count = 0;
pair<int, int> now;
cin >> width >> height >> x >> y >> n;
for (int i = 0; i < n; i++) {
cin >> now.first >> now.second;
if (now.first >= x && now.first <= x + width) {
if (now.second >= y && now.second <= y + height)
count++;
}
else if (now.first < x) {
if (4 * (pow(now.first - x, 2) + pow(now.second - y - height/2, 2)) <= height * height)
count++;
}
else if (now.first > x + width) {
if (4 * (pow(now.first - x - width, 2) + pow(now.second - y - height/2, 2)) <= height * height)
count++;
}
}
cout << count << "\n";
return 0;
}