luoguP1003 铺地毯 题解(NOIP2011)
2024-09-06 00:00:12
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
inline int read()
{
int sum=,p=;char ch=getchar();
while(!((''<=ch && ch<='') || ch=='-'))ch=getchar();
if(ch=='-')p=-,ch=getchar();
while(''<=ch && ch<='')sum=sum*+ch-,ch=getchar();
return sum*p;
}
struct ditan{
int zxx,zxy,ysx,ysy;
}a[];
int main()
{
int n,xx,yy,lx,ly,x,y;
n=read();
for(int i=;i<=n;i++)
{
xx=read();yy=read();lx=read();ly=read();
a[i].zxx=xx;a[i].zxy=yy;a[i].ysx=xx+lx;a[i].ysy=yy+ly;
}
x=read();y=read();
for(int i=n;i>=;i--)
{
if(a[i].zxx<=x&&a[i].zxy<=y&&a[i].ysx>=x&&a[i].ysy>=y)
{
cout<<i<<endl;
return ;
}
}
cout<<"-1"<<endl;
return ;
}
最新文章
- PMP--综合考试知识点,持续更新中。。。
- Android的setVisibility(View.GONE)无效的问题及原因分析
- C++基础入门
- Notice: Trying to get property of non-object problem(PHP)解决办法 中间件只能跳转不能返任何数据
- 信息安全系统设计基础exp_4
- mapping 详解1(mapping type)
- dedecms修改templets为别的名字
- 关于android:screenOrientation=";portrait"; 横竖屏切换
- C#操作Xml:XSLT语法 在.net中使用XSLT转换xml文档示例
- IOC and DI
- phpcms v9 后台首页 去掉团队信息等版权
- 警惕!MySQL成数据勒索新目标
- 一次关于mongodb性能踩坑的总结
- java子类和父类中静态块、非静态块、构造函数的执行顺序
- bootstrap-datepicker简单使用
- C 长字符串换行方法
- Python中通过lambda抛异常的奇技淫巧
- Mysql5.6 自动化部署
- Swoole 异步mysql使用
- MD Test
热门文章
- CSS3 Animations
- C#基础提升系列——C#任务和并行编程
- 030:spaceless和autoescape 标签
- 3,LinkedList
- delegate operator (C# reference) and =>; operator (C# reference)
- 使用WebAPI流式传输大文件(在IIS上大于2GB)
- Yii 1.1 常规框架部署和配置
- RDA项目debug
- win10下VMware15运行ubuntu18.04无法和主机之间复制粘贴问题
- python numpy求四分位距