시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
5 초 512 MB 121 50 44 39.640%

문제

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

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

Dr. Spaceman가 만들어낸,

알고리즘이 알려줍니다.

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

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

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

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

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

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

Dr. Spaceman은 확신해요.

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

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

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

Dr. Spaceman은 답해요.

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

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

입력

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

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

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

출력

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

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

제한

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

예제 입력 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"
W3sicHJvYmxlbV9pZCI6IjEyMzUzIi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dHB1dCBvbmUgbGluZSBjb250YWluaW5nICZxdW90O0Nhc2UgI3g6IDxzdHJvbmc+QTxcL3N0cm9uZz4gdG8gPHN0cm9uZz5CPFwvc3Ryb25nPiZxdW90Oywgd2hlcmUgeCBpcyB0aGUgY2FzZSBudW1iZXIgKHN0YXJ0aW5nIGZyb20gMSksIDxzdHJvbmc+QTxcL3N0cm9uZz4gaXMgdGhlIHNtYWxsZXN0IGFuZCA8c3Ryb25nPkI8XC9zdHJvbmc+IGlzIHRoZSBsYXJnZXN0IGJhYnkgaGVpZ2h0LCBhY2NvcmRpbmcgdG8gRHIuIFNwYWNlbWFuJiMzOTtzIGFsZ29yaXRobS4gSWYgdGhlIGFsZ29yaXRobSBwcm9kdWNlcyBhIHJhbmdlIHdob3NlIGVuZHBvaW50cyBmYWxsIG9uIGZyYWN0aW9uYWwgaW5jaGVzLCB5b3VyIHByb2dyYW0gc2hvdWxkIHNocmluayB0aGUgcmFuZ2UgdW50aWwgYm90aCBlbmRwb2ludHMgY2FuIGJlIGV4cHJlc3NlZCBpbiB3aG9sZSBpbmNoZXMuPFwvcD5cclxuIiwiaGludCI6IjxwPk5vdGU8XC9wPlxyXG5cclxuPHA+TWFrZSBzdXJlIHRvIG91dHB1dCB0aGUgaGVpZ2h0cyB1c2luZyBleGFjdGx5IHRoZSByaWdodCBmb3JtYXQgLS0gbm8gc3BhY2VzLCBvbmUgYXBvc3Ryb3BoZSwgb25lIGRvdWJsZSBxdW90ZSwgY29ycmVjdCBsZXR0ZXIgY2FzZSwgYW5kIGluY2hlcyBvbmx5IGJldHdlZW4gMCBhbmQgMTEgaW5jbHVzaXZlLjxcL3A+XHJcbiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

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

채점

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