관리 메뉴

솜씨좋은장씨

[BaekJoon] 9838번 : XMAS (Python) 본문

Programming/코딩 1일 1문제

[BaekJoon] 9838번 : XMAS (Python)

솜씨좋은장씨 2021. 12. 25. 12:25
728x90
반응형

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

 

9838번: XMAS

Your program must write a mapping from the guests to the recipients of their gifts to the standard output. The first line contains an integer indicating the recipient of the gift brought by guest 1. Similarly, the second line contains an integer indicating

www.acmicpc.net

👨🏻‍💻 코드 ( Solution )

def XMAS(gift_list):
    check_dict = {}
    for idx, gift in enumerate(gift_list, start=1):
        check_dict[gift] = idx

    items = [item[1] for item in sorted(check_dict.items(), key=lambda x: x[0])]
    
    return items
    
if __name__ == "__main__":
    gift_list = []
    for _ in range(int(input())):
        gift_list.append(int(input()))
        
    check_list = XMAS(gift_list)
    
    for check in check_list:
        print(check)
 

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