시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
5 초 512 MB 117 47 41 38.318%

문제

모든 부모는 궁금해 합니다.

자식들의 키가 어떻게 될지.

Dr. Spaceman가 만들어낸,

알고리즘이 알려줍니다.

정확하고, 틀리지 않습니다.

유전자학으로 얻어낸 결과죠.

아빠 키에 엄마 키를 더하고,

남자아이는, 5인치를 더하고,

여자아이는, 5인치를 뺍니다.

2로 나누면 윤곽이 보입니다.

Dr. Spaceman은 확신해요.

4인치를 가감하면 나옵니다.

아이 키의 범위가 나옵니다.

부모가 아이의 키를 물으면,

Dr. Spaceman은 답해요.

답을 이 사이에서 알려줍니다.

그리고 이 답변은 정확하죠.

입력

입력의 첫 번재 줄에는 테스트 케이스의 개수를 의미하는 T가 주어진다. 그 뒤에는 T개의 라인이 입력된다.

각 라인은 알파벳 한 글자('B'는 남자아이(boy), 'G'는 여자아이(girl))와 공백 한 칸, 엄마의 키, 공백 한 칸, 아빠의 키가 주어집니다.

키는 피트, 작은따옴표('), 인치, 큰따옴표(")로 이루어지며, 피트(feet)는 양의 정수이고, 인치(inch)는 음이 아닌 정수입니다.

제한

  • 1 ≤ T ≤ 6000.
  • 입력되는 피트의 숫자는 1 과 9 이내의 숫자이다.
  • 입력되는 인치의 숫자는 0 과 11 이내의 숫자이다.

출력

각각의 테스트 케이스에 대해 "Case #x: A to B"의 형식으로 출력한다.

x는 (1부터 시작하는) 케이스의 번호를, AB에는 각각 아이의 키의 최솟값/최댓값을 Dr. Spaceman의 알고리즘에 따라 출력한다. 만약 결과가 인치 단위에서 정수가 되지 않을 경우, 구간의 양 끝 값을 안쪽으로 조여(shrink) 정수 범위로 만들어 출력해야 합니다.

예제 입력 1

4
B 5'11" 6'2"
G 5'11" 6'2"
B 3'4" 3'4"
G 1'1" 1'0"

예제 출력 1

Case #1: 5'11" to 6'7"
Case #2: 5'6" to 6'2"
Case #3: 3'3" to 3'10"
Case #4: 0'6" to 1'2"
W3sicHJvYmxlbV9pZCI6IjEyMzUz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A+XHJcbiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

Contest > Google Code Jam > Code Jam for Veterans 2013 > Online Competition B1번

채점

  • 예제는 채점하지 않는다.