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

12246번 - Enclosure (Small) 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 512 MB43161443.750%

문제

Your task in this problem is to find out the minimum number of stones needed to place on an N-by-M rectangular grid (N horizontal line segments and M vertical line segments) to enclose at least K intersection points. An intersection point is enclosed if either of the following conditions is true:

  1. A stone is placed at the point.
  2. Starting from the point, we cannot trace a path along grid lines to reach an empty point on the grid border through empty intersection points only.

For example, to enclose 8 points on a 4x5 grid, we need at least 6 stones. One of many valid stone layouts is shown below. Enclosed points are marked with an "x".

입력

The first line of the input gives the number of test cases, T. T lines follow. Each test case is a line of three integers: N M K.

Limits

  • 1 ≤ T ≤ 100.
  • 1 ≤ N.
  • 1 ≤ M.
  • 1 ≤ KN × M.
  • N × M ≤ 20.

출력

For each test case, output one line containing "Case #x: y", where x is the test case number (starting from 1) and y is the minimum number of stones needed.

제한

예제 입력 1

2
4 5 8
3 5 11

예제 출력 1

Case #1: 6
Case #2: 8

힌트

출처

Contest > Google > Code Jam > Google Code Jam 2014 > Round 1C C1번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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