• [1124] Cut Ribbon

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties:

    • Have positive area.
    • With vertices at integer points.
    • All vertices of the rhombi are located inside or on the border of the rectangle with vertices at points (0, 0), (w, 0), (w, h), (0, h). In other words, for all vertices (xi, yi) of the rhombus the following conditions should fulfill: 0 ≤ xiw and 0 ≤ yih.
    • Its diagonals are parallel to the axis.

    Count the number of such rhombi.

    Let us remind you that a rhombus is a quadrilateral whose four sides all have the same length.


  • 输入
  • The first line contains two integers w and h (1 ≤ w, h ≤ 4000) — the rectangle's sizes.
  • 输出
  • Print a single number — the maximum possible number of ribbon pieces. It is guaranteed that at least one correct ribbon cutting exists.
  • 样例输入
  • 5 5 3 2
    7 5 5 2
  • 样例输出
  • 2
    2
  • 提示
  • In the first example Polycarpus can cut the ribbon in such way: 
    the first piece has length 2, the second piece has length 3.
    
    In the second example Polycarpus can cut the ribbon in such way: 
    the first piece has length 5, the second piece has length 2.
    
    
  • 来源
  • CodeForces
  • 操作

显示春菜