포럼
문제 ICPC00261

C. Cocoa Coalition

설명

Alice and Bob decide to share a chocolate bar, which is an \(n\) by \(m\) rectangular grid of chocolate cells. They decide that Alice should get \(a < n \cdot m\) pieces and that Bob should get $b = n \cdot m -
a$ pieces. To split the chocolate bar, they repeatedly take a single piece of chocolate and break it either horizontally or vertically, creating two smaller pieces of chocolate. See Figure for an example.

What is the minimum number of splits that Alice and Bob need to perform in order to split the \(n\)-by-\(m\) chocolate bar into two piles consisting of \(a\) and \(b\) chocolate cells?

제약
입력 형식

The input consists of a single line, containing the three integers \(n\), \(m\) and \(a\) (\(1 \le n, m \le 10^6\), \(1 \le a < n \cdot m\)).

출력 형식

Output the minimum number of splits needed to achieve the desired division of chocolate.

예제 1
입력
3 10 9
출력
1
예제 2
입력
10 10 71
출력
3
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NCPC 2019

평가 및 의견

C. Cocoa Coalition

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

C. Cocoa Coalition

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8