728x90
풀이
세 수를 입력받아 만약 아무 두 수의 합이 다른 수와 같음 1을,
아무 두 수의 곱이 다른 수와 같으면 2를
그게 아니라면 3을 출력하면 된다.
모든 경우를 확인하기 귀찮으니, 입력받은 수를 오름차순으로 정렬해서 1, 2번째 수에 대해서만 확인해주자.
2 ~ 1000사이의 수이므로 결국 두 수의 합과 곱이 다른 수와 일치하기 위해서는 다른 수의 값보다 작거나 같아야 하기 때문에 가능하다.
소스코드
출처
25784번: Easy-to-Solve Expressions
When one looks at a set of numbers, one usually wonders if there is a relationship among them? This task is more manageable if there are only three numbers. Given three distinct positive integers, you are to determine how one can be computed using the othe
www.acmicpc.net
728x90
'PS > Baekjoon Online Judge' 카테고리의 다른 글
[백준 25858] Divide the Cash [Python] (0) | 2023.08.05 |
---|---|
[백준 25828] Corona Virus Testing [Python] (0) | 2023.08.05 |
[백준 25704] 출석 이벤트 [Python] (0) | 2023.08.04 |
[백준 25625] 샤를버스 [Python] (0) | 2023.08.03 |
[백준 25591] 푸앙이와 종윤이 [Python] (0) | 2023.08.03 |