new file: P1003.cpp P1005.cpp P1006.cpp P1007.cpp

This commit is contained in:
hanyixuanten
2026-07-06 14:04:43 +08:00
parent 2496907fa2
commit 8a71596ea6
4 changed files with 142 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#include <cstdio>
using namespace std;
int n;
int x1[10005], y1[10005], x2[10005], y2[10005];
int main()
{
scanf("%d", &n);
for (int c = 1; c <= n; c++)
{
int x, y, lx, ly;
scanf("%d %d %d %d", &x, &y, &lx, &ly);
x1[c] = x, x2[c] = x + lx, y1[c] = y, y2[c] = y + ly;
}
int x, y;
scanf("%d %d", &x, &y);
for (int i = n; i >= 1; i--)
{
if (x >= x1[i] && x <= x2[i] && y >= y1[i] && y <= y2[i])
{
printf("%d\n", i);
return 0;
}
}
puts("-1");
return 0;
}