From 6fe2912c740873375517d6cfc24352bd3d905266 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Wed, 18 Nov 2020 19:16:44 +0800 Subject: [PATCH] =?UTF-8?q?P2074=20=E5=8D=B1=E9=99=A9=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R42122741 --- problem/P2074/P2074.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 problem/P2074/P2074.cpp diff --git a/problem/P2074/P2074.cpp b/problem/P2074/P2074.cpp new file mode 100644 index 00000000..e94b37e3 --- /dev/null +++ b/problem/P2074/P2074.cpp @@ -0,0 +1,23 @@ +#include + +using namespace std; + +int n, m, k, t, x, y, ans, sum; + +int main() { + cin >> n >> m >> k >> t; + for (int i = 0; i < k; i++) { + sum = 0; + cin >> x >> y; + for (int i = max(1, x - t); i <= min(n, x + t); i++) { + for (int j = max(1, y - t); j <= min(m, y + t); j++) { + if (sqrt((x - i) * (x - i) + (y - j) * (y - j)) <= t) { + sum++; + } + } + } + ans = max(ans, sum); + } + cout << ans << endl; + return 0; +}