zoukankan      html  css  js  c++  java
  • 《Cracking the Coding Interview》——第7章:数学和概率论——题目5

    2014-03-20 02:20

    题目:给定二维平面上两个正方形,用一条直线将俩方块划分成面积相等的两部分。

    解法:穿过对称中心的线会将面积等分,所以连接两个中心即可。如果两个中心恰好重合,那么任意穿过这个点的直线都满足条件。

    代码:

    1 // 7.5 Given two squares on two-dimensional plane, draw a line to cut them in two parts with equal area.
    2 // Answer:
    3 //    Apparently the line should go through the center of the two squares.
    4 //    If their center coincide, any line that goes through this center will suffice.
    5 int main()
    6 {
    7     return 0;
    8 }
  • 相关阅读:
    线程池
    多线程随笔
    注解随笔
    反射机制
    iO流
    FastDFS+docker建立分布式文件系统
    Java之Exception
    Java之String
    手写SpringMvc
    spring中一些常用注解的含义
  • 原文地址:https://www.cnblogs.com/zhuli19901106/p/3612773.html
Copyright © 2011-2022 走看看