1985번 - 디지털 친구
원본 문제에 설명에서
"A neighbor exchanges two neighbouring digits a and b into a-1 and b+1, or into a+1 and b-1, provided that these new digits are still in the range 0...9," 라고 되어 있습니다.
x와 y가 정수라고 하였기 때문에
a와 b의 조건을 "0 <= a, b <= 9"로 지정하지 않으면
-1이나 10이 되는 오버플로우 연산을 고려하게되면서 다른 문제가 되는 것 같습니다.
댓글을 작성하려면 로그인해야 합니다.
choiyoujun 4년 전
원본 문제에 설명에서
"A neighbor exchanges two neighbouring digits a and b into a-1 and b+1, or into a+1 and b-1, provided that these new digits are still in the range 0...9," 라고 되어 있습니다.
x와 y가 정수라고 하였기 때문에
a와 b의 조건을 "0 <= a, b <= 9"로 지정하지 않으면
-1이나 10이 되는 오버플로우 연산을 고려하게되면서 다른 문제가 되는 것 같습니다.