문제에는 분명 ' 합과 차는 1000보다 작거나 같은 음이 아닌 정수이다. '라고 나와 있는데 조건에는 왜 음수조건을 넣어야 맞다고 체점되나요?
a, b = map(int, input().split()) x = int((a + b)/2)y = int((a - b)/2) if x + y != a or x > y and x - y != b or x < y and y - x != b: print('-1')else: print(x, y) 위 코드는 틀렸다되구요
a, b = map(int, input().split()) x = int((a + b)/2)y = int((a - b)/2) if x + y != a or x > y and x - y != b or x < y and y - x != b or x < 0 or y < 0: print('-1')else: print(x, y) 이 코드는 맞다고 되요
no_rang 2년 전 1
문제에는 분명 ' 합과 차는 1000보다 작거나 같은 음이 아닌 정수이다. '라고 나와 있는데 조건에는 왜 음수조건을 넣어야 맞다고 체점되나요?
a, b = map(int, input().split())
x = int((a + b)/2)y = int((a - b)/2)
if x + y != a or x > y and x - y != b or x < y and y - x != b: print('-1')else: print(x, y)
위 코드는 틀렸다되구요
a, b = map(int, input().split())
x = int((a + b)/2)y = int((a - b)/2)
if x + y != a or x > y and x - y != b or x < y and y - x != b or x < 0 or y < 0: print('-1')else: print(x, y)
이 코드는 맞다고 되요