관리 메뉴

솜씨좋은장씨

[BaekJoon] 25858번 : Divide the Cash (Python) 본문

Programming/코딩 1일 1문제

[BaekJoon] 25858번 : Divide the Cash (Python)

솜씨좋은장씨 2022. 10. 28. 12:35
728x90
반응형

코딩 1일 1문제! 오늘의 문제는 백준의 Divide the Cash 입니다.

 

25858번: Divide the Cash

The UCF Programming Team coaches schedule practices regularly in fall and spring (by the way, all UCF students are welcome to the practices). During summer, the majority of the team members are gone but the coaches know how to make sure the students don’

www.acmicpc.net

👨🏻‍💻 코드 ( Solution )

def divide_the_cash(team_member_numbers, money):
    total_team_num = sum(team_member_numbers)
    
    money_for_each_member = money // total_team_num
    
    return [member_num * money_for_each_member for member_num in team_member_numbers]


def print_answer(answer):
    for ans in answer:
        print(ans)


if __name__ == "__main__":
    team_member_numbers = []
    N, money = map(int, input().split())
    
    for _ in range(N):
        member_num = int(input())
        team_member_numbers.append(member_num)
    
    answer = divide_the_cash(
        team_member_numbers=team_member_numbers, money=money
    )
    
    print_answer(answer=answer)
 

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