logo AlgoBeat OnlineJudge
登录 注册

#214900. [NERC 2025] Honey Cake

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

题目描述

Hannah and Henry are going to host a party for people, including themselves.

They bought a honey cake of size inches for the party, and want to split it into equal pieces. The honey cake can be cut parallel to any of its faces. To make cuts precise, each edge of length is cut into the same number of equal parts, each having integer length; similarly for edges of lengths and . Given the dimensions of the honey cake, determine whether it is possible to cut it into equal pieces, and if so, how.

输入格式

The first line of input contains three integers: , , and , the dimensions of the honey cake in inches ().

The second line contains a single integer ().

输出格式

Output three integers , , , the number of cuts to be made along each of the dimensions , , and , respectively, if it is possible to cut the cake, or a single integer otherwise. Note that making zero cuts along a dimension is allowed, too.

样例

样例输入 1

10 20 6
40

样例输出 1

4 3 1

数据范围与提示

In the first example, the cake will be cut into pieces of size inches.

:::align{center} :::