본문 바로가기
공부/코딩테스트

백준: 23375번 Arm Coordination (Python3)

by 혼밥맨 2022. 8. 9.
반응형

백준: 23375번 Arm Coordination (Python3)

Arm Coordination 성공스페셜 저지다국어

 
시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB 503 374 344 75.274%

문제

All the cool kids in town want to become a member of the Bots and Androids Programmer Club (BAPC). To become a member of the club, applicants must show a feat of their skills with a home-made robot that is programmed to perform some tricks. Just like your older brother, you want to become a member of the BAPC, so it's time to lock yourself in the hobby basement and start building some robots!

Since your older brother has used up almost all of the parts for his own projects at the BAPC, you will have to get creative with whatever is still left. You find a robotic arm that has only a single purpose: fitting circle-shaped objects into square-shaped holes. Not exactly what you had in mind, but it will have to do. After all, you only have five hours left to apply for your BAPC membership.

The memory chip of the robotic arm seems to be wiped, but luckily you do know the programming interface of its ARM processor. Firstly, the robotic arm only supports integer coordinates. Secondly, when the arm picks up a circle-shaped object, you need to calculate the smallest possible square that it could fit the object in, after which it will autonomically find a suitable square-shaped hole.

Given the location of a circle-shaped object, calculate the smallest possible square which encloses the object.

입력

The input consists of:

  • One line containing two integers x and y (−109≤x,y≤109), the coordinates of the center of the circle.
  • One line containing one integer r (1≤r≤109), the radius of the circle.

출력

Output four lines, each line containing two integers, representing the x- and y-coordinates of one of the corners of the square. The coordinates should be printed in either clockwise or counter-clockwise order.

If there are multiple valid solutions, you may output any one of them.

예제 입력 1

-3 6
5

예제 출력 1 (<-- 문제의 테스트 케이스가 틀렸음. 무시할 것.)

-10 7
-2 13
4 5
-4 -1

예제 입력 2 

0 0
10

예제 출력 2  (<-- 문제의 테스트 케이스가 틀렸음. 무시할 것.)

-14 -2
-2 14
14 2
2 -14

답안

1
2
3
4
5
6
7
x,y=map(int,input().split())
r=int(input())
 
print(x-r, y+r)
print(x+r, y+r)
print(x+r, y-r)
print(x-r, y-r)
cs

반응형

댓글