관리 메뉴

솜씨좋은장씨

[BaekJoon] 25784번 : Easy-to-Solve Expressions (Python) 본문

Programming/코딩 1일 1문제

[BaekJoon] 25784번 : Easy-to-Solve Expressions (Python)

솜씨좋은장씨 2022. 10. 14. 12:45
728x90
반응형

코딩 1일 1문제! 오늘의 문제는 백준의 Easy-to-Solve Expressions 입니다.

 

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

👨🏻‍💻 코드 ( Solution )

def is_sum_num_exist(num1, num2, num3):
    is_exist = False
    if num1 == num2 + num3:
        is_exist = True
    elif num2 == num1 + num3:
        is_exist = True
    elif num3 == num1 + num2:
        is_exist = True
        
    return is_exist
        

def is_multiply_num_exist(num1, num2, num3):
    is_exist = False
    if num1 == num2 * num3:
        is_exist = True
    elif num2 == num1 * num3:
        is_exist = True
    elif num3 == num1 * num2:
        is_exist = True
        
    return is_exist


def easy_to_solve_expressions(num1, num2, num3):
    answer = 3
    
    is_sum_exist = is_sum_num_exist(
        num1=num1, num2=num2, num3=num3
    )
    
    is_multiply_exist = is_multiply_num_exist(
        num1=num1, num2=num2, num3=num3
    )
    
    if is_sum_exist:
        answer = 1
    elif is_multiply_exist:
        answer = 2
    
    return answer


if __name__ == "__main__":
    num1, num2, num3 = map(int, input().split())
    
    print(easy_to_solve_expressions(num1=num1, num2=num2, num3=num3))
 

GitHub - SOMJANG/CODINGTEST_PRACTICE: 1일 1문제 since 2020.02.07

1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.

github.com

Comments