diff --git a/pu2rile/README.md b/pu2rile/README.md index 71080ed..669c188 100644 --- a/pu2rile/README.md +++ b/pu2rile/README.md @@ -6,4 +6,4 @@ | 2차시 | 2024.03.29 | 구현 | [OX퀴즈](https://www.acmicpc.net/problem/8958) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/6#issue-2214931034)| | 3차시 | 2024.04.02 | 문자열 | [크로아티아 알파벳](https://www.acmicpc.net/problem/8958) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/10#issue-2220631332) | 4차시 | 2024.04.08 | 스택 | [제로](https://www.acmicpc.net/problem/10773) | [#15](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/15#issue-2229909173) -| 5차시 | 2024.04.10 | 그리디 알고리즘 | [국회의원 선거](https://www.acmicpc.net/problem/1417) | [#18](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/18#issue-2235862658) +| 5차시 | 2024.04.10 | 그리디 알고리즘 | [국회의원 선거](https://www.acmicpc.net/problem/1417) | [#18](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/18#issue-2235862658) \ No newline at end of file diff --git "a/pu2rile/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/\352\265\255\355\232\214\354\235\230\354\233\220 \354\204\240\352\261\260.py" "b/pu2rile/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/\352\265\255\355\232\214\354\235\230\354\233\220 \354\204\240\352\261\260.py" new file mode 100644 index 0000000..4b4996f --- /dev/null +++ "b/pu2rile/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/\352\265\255\355\232\214\354\235\230\354\233\220 \354\204\240\352\261\260.py" @@ -0,0 +1,19 @@ +N = int(input()) +dasom = int(input()) +vote = [] +cnt = 0 + +for _ in range(N-1): + vote.append(int(input())) + +vote.sort(reverse=True) #내림차순 정렬 + +if N == 1: + print('0') +else: + while vote[0] >= dasom: + dasom += 1 + vote[0] -= 1 + cnt += 1 + vote.sort(reverse=True) + print(cnt)