#P1548. [NOIP 1997 普及组] 棋盘问题

[NOIP 1997 普及组] 棋盘问题

Description

Given a chessboard with an N×MN \times M grid (1N100,1M100)(1≤N≤100,1≤M≤100), find how many squares and how many rectangles (excluding squares) it contains.

For example, when N=2,M=3N=2, M=3:

The number of squares is 88: there are 66 squares of side length 11 and 22 squares of side length 22.

The number of rectangles is 1010:

Specifically:

  • There are 44 rectangles of size 2×12 \times 1:

  • There are 33 rectangles of size 1×21 \times 2:

  • There are 22 rectangles of size 3×13 \times 1:

  • There is 11 rectangle of size 3×23 \times 2:

Input Format

One line with two integers N,MN,M.

Output Format

One line with two integers, the number of squares and the number of rectangles.

2 3
8 10

Hint

Translated by ChatGPT 5