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

33105번 - Chocolate Bar 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB28111037.037%

문제

You have a bar of chocolate which can be represented as a rectangle. Originally, the chocolate bar has a width of $N$ and a height of $M$. For this problem, denote $(n \times m)$ as a chocolate bar with a width of $n$ and a height of $m$.

You want to eat the chocolate with a total area of exactly $K$. However, you always eat a chocolate bar as a whole; that is, if you eat a chocolate bar $(n \times m),ドル then you will eat all the chocolate with area $n \cdot m$.

To be able to eat exactly $K$ total area, you are allowed to perform any of the following operations any number of times (possibly zero).

  • Pick one bar of chocolate $(n \times m)$ then split it into two bars: $(n \times i)$ and $(n \times (m - i))$ such that $i$ is an integer that satisfies 1ドル ≤ i < m$.
  • Pick one bar of chocolate $(n \times m)$ then split it into two bars: $(i \times m)$ and $((n - i) \times m)$ such that $i$ is an integer that satisfies 1ドル ≤ i < n$.

Determine the minimum number of operations such that it is possible to eat some chocolate bars with a total area of $K$.

입력

Input consists of three integers $N$ $M$ $K$ (1ドル ≤ N, M ≤ 10^6$; 1ドル ≤ K ≤ N \cdot M$).

출력

Output a single integer representing the minimum number of operations such that it is possible to eat some chocolate bars with a total area of $K$.

제한

예제 입력 1

4 4 10

예제 출력 1

2

The following illustration shows one of the solutions to this sample. The chocolate bars that you eat are colored red.

예제 입력 2

5 6 6

예제 출력 2

1

예제 입력 3

1 1 1

예제 출력 3

0

힌트

출처

ICPC > Regionals > Asia Pacific > Indonesia > Indonesia National Contest > INC 2023 M번

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

출처

대학교 대회

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

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