luogu P1003 铺地毯

水题

 1 #include<stdio.h>
 2 #include<string.h>
 3 #include<algorithm>
 4 using namespace std;
 5 template<class T>void read(T &x){
 6     int f=0;x=0;char ch=getchar();
 7     while(ch<'0'||ch>'9')  {f|=(ch=='-');ch=getchar();}
 8     while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
 9     x=f?-x:x;
10 }
11 
12 const int N=10007;
13 int a[N],b[N],g[N],k[N];
14 int n,x,y;
15 
16 int main(){
17     read(n);
18     for(int i=1;i<=n;++i)
19         read(a[i]),read(b[i]),read(g[i]),read(k[i]);
20     read(x),read(y);
21     for(int i=n;i>=1;--i)
22         if(a[i]<=x&&a[i]+g[i]>=x&&b[i]<=y&&b[i]+k[i]>=y){
23             printf("%d\n",i);
24             return 0;
25         }
26     printf("-1\n");
27     return 0;
28 }

 

转载于:https://www.cnblogs.com/Peper/p/9947603.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值