#include #include using namespace std;

int main() { int n, a, b; cin >> n >> a >> b; int ans = 1; //最少可以抓一个敌人 int x[n], y[n]; for (int i = 0; i < n; i++) { cin >> x[i] >> y[i]; } for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { int dx = abs(x[i] - x[j]); //横坐标差值 int dy = abs(y[i] - y[j]); //纵坐标差值 if (dx <= a && dy <= b) { //如果符合要求 ans = max(ans, j - i + 1); //更新答案 } } } cout << ans << endl; return 0; }

C++ 实现全屏技能捕获游戏敌人最大数量

原文地址: https://www.cveoy.top/t/topic/lHQ8 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录