logo AlgoBeat OnlineJudge
登录 注册

#217653. [ECNA 2025] AROD

内存限制:2048 MiB 时间限制:4000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Since retiring from a lucrative athletic career, Alex has devoted most of his time to pondering foundational concepts in mathematics. Recently, he has been focusing on the categorization of triangles based on their interior angles, and has invented the acronym AROD to keep track of the four fundamental types:

  • A = acute: all three angles are less than degrees

  • R = right: one angle is degrees

  • O = obtuse: one angle is greater than degrees, but less than degrees

  • D = degenerate: one angle is degrees, or, equivalently, the three vertices are collinear

Alex wonders how often three distinct vertices chosen from a regular grid of points specify a triangle in each of the four AROD categories. More precisely, for positive integers and he wants to consider all possible ways of choosing three distinct vertices from the set V(m_x,m_y) = { (x,y) : x \textrm{ and } y \textrm{ are integers, } 0 \leq x \leq m_x, 0 \leq y \leq m_y } and then categorize each of the corresponding triangles into one of the four categories listed above.

输入格式

The input is a line containing two positive integers, and satisfying

输出格式

Output four lines containing the numbers of times three distinct vertices chosen from specify an acute, right, obtuse, or degenerate triangle, in that order (one number per line).

样例

样例输入 1

1 2

样例输出 1

0
14
4
2

样例输入 2

2 3

样例输出 2

22
94
84
20