编程介的小学生 2018-11-24 06:14 采纳率: 20.5%
浏览 641
已采纳

这个阿里出的考题,怎么用算法编程去实现?

Problem Description

Ali’s room is full of books and he has never come up with a good way to arrange them. He just put them on the desk. But sometimes the books became unstable due to the gravity, and some might slide off the desk. He found it very annoying and decided to use a new method to put his books.
He bought some magic clips to stabilize the books. Once he put a book onto the desk, he will check if the book is steady. If it is, then he will use a clip to stabilize it and it will never slide or flip. If not, he will just pick up the book and throw it onto the floor and deal with it later.
But as he began to use the new method, he found it hard to decide whether a book is steady when put it on the desk. So he needs your help to determine that.
Assume that every book has the same thickness.
A book is steady means it will stay unmoved and horizontal even if given a small force.

Input
The input consists several testcases.
The first line contains the number of books N (1 <= N <= 2000).
The following N lines each contains four integers, x1,y1,x2,y2 (-103 <= x1, y1, x2, y2 <= 103), means that the i-th book is placed with lower-left-corner placed at x1,y1 and upper-right-corner placed at x2,y2 (if you look down from above). The book’s edge is always paralleled with the desk’s edge.

Output
Print one integer, the number of books that are remained on the desk.

Sample Input
3
0 0 2 2
-1 0 3 1
2 0 3 2

Sample Output
2

  • 写回答

1条回答

  • threenewbee 2019-01-28 23:22
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器