Logo
(追記) (追記ここまで)

35046번 - Honey Cake 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 2048 MB19161583.333%

문제

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

They bought a honey cake of size $w \times h \times d$ inches for the party, and want to split it into $n$ equal pieces.

The honey cake can be cut parallel to any of its faces. To make cuts precise, each edge of length $w$ is cut into the same number of equal parts, each having integer length; similarly for edges of lengths $h$ and $d$.

Given the dimensions of the honey cake, determine whether it is possible to cut it into $n$ equal pieces, and if so, how.

입력

The first line of input contains three integers: $w,ドル $h,ドル and $d,ドル the dimensions of the honey cake in inches (1ドル \le w, h, d \le 10^9$).

The second line contains a single integer $n$ (1ドル \le n \le 10^9$).

출력

Output three integers $w_c,ドル $h_c,ドル $d_c,ドル the number of cuts to be made along each of the dimensions $w,ドル $h,ドル and $d,ドル respectively, if it is possible to cut the cake, or a single integer $-1$ 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 5ドル \cdot 4 \cdot 2 = 40$ pieces of size 2ドル \times 5 \times 3$ inches.

출처

ICPC > Regionals > Northern Eurasia > Northern Eurasia Finals > Northern Eurasia Finals 2025 H번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /