私の思想
铺地毯
http://www.nowcoder.com/questionTerminal/a102724d530940cd80c54f3df6d41572
暴力求解
#include <bits/stdc++.h> using namespace std; struct carpet{ int x,y,a,b; }c[10010]; int n;int o,p; int ans=-1; int main() { scanf("%d",&n); for (int i = 1; i <=n ; ++i) { scanf("%d %d %d %d",&c[i].x,&c[i].y,&c[i].a,&c[i].b); c[i].a+=c[i].x; c[i].b+=c[i].y; } // cout<<n; scanf("%d %d",&o,&p); while(n){ if(o>=c[n].x&&p>=c[n].y&&o<=c[n].a&&p<=c[n].b) { ans=n; break; } n--; } cout<<ans; return 0; }