시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB123706756.303%

문제

Given three integers and the arithmetic operators ($+$, $-$, $*$, $/$), determine the smallest non-negative integer possible without changing the order of the initial integers. Order of the operators is without their normal precedence, just left-to-right. Note: integer division is fine only if the remainder is zero. For example, $9/3$ is okay, $10/3$ is not.

For example:

For $2$, $3$ and $5$, the answer is $0$ ($2+3-5$)

For $9$, $9$ and $9$, the answer is $0$ ($9-9\ /\ 9$)

For $5$, $7$ and $3$, the answer is $1$ ($5-7+3$)

Given three integers, determine the smallest non-negative result that can be computed by placement of the given operators between the numbers. The operators may only be placed between numbers, not in front (they are not unary operators). An operator must be placed between each pair of numbers, numbers cannot be concatenated.

입력

The single line of input contains three integers, all in the range from $1$ to $1{,}000$.

출력

Output a single integer, which is the smallest non-negative value possible applying the arithmetic operators.

예제 입력 1

2 3 5

예제 출력 1

0

예제 입력 2

9 9 9

예제 출력 2

0

예제 입력 3

5 7 3

예제 출력 3

1

출처

ICPC > Regionals > North America > North America Qualification Contest > ICPC North America Qualifier 2022 K번

  • 문제를 만든 사람: Howard Whitston