diff --git a/dohyeondol1/README.md b/dohyeondol1/README.md index 26f1ff5..a674590 100644 --- a/dohyeondol1/README.md +++ b/dohyeondol1/README.md @@ -22,3 +22,5 @@ | 18차시 | 2025.07.04 | 기하학 | [Water Testing](https://www.acmicpc.net/problem/16057)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/70| | 19차시 | 2025.07.09 | 그래프 이론 | [최소 스패닝 트리](https://www.acmicpc.net/problem/1197)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/76| | 20차시 | 2025.07.10 | 문자열 | [접두사](https://www.acmicpc.net/problem/1141)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/78| + | 21차시 | 2025.07.14 | 그래프 이론 | [석고 모형 만들기](https://www.acmicpc.net/problem/32031)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/81| + | 21차시 | 2025.07.19 | 그리디 알고리즘 | [대회 개최](https://www.acmicpc.net/problem/12915)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/87| \ No newline at end of file diff --git "a/dohyeondol1/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/22-dohyeondol1.cpp" "b/dohyeondol1/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/22-dohyeondol1.cpp" new file mode 100644 index 0000000..dbb53db --- /dev/null +++ "b/dohyeondol1/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/22-dohyeondol1.cpp" @@ -0,0 +1,59 @@ +#include +using namespace std; + +int totalCompetiton; + +int main() { + int easy, easyMedium, medium, mediumHigh, high; + cin >> easy >> easyMedium >> medium >> mediumHigh >> high; + + while(true) { + bool easySubmitted = false; + bool mediumSubmitted = false; + bool highSubmitted = false; + + if(easy) { + easy--; + easySubmitted = true; + } + else { + if(easyMedium) { + easyMedium--; + easySubmitted = true; + } + } + + if(medium) { + medium--; + mediumSubmitted = true; + } + else { + if(easyMedium || mediumHigh) { + if(easyMedium >= mediumHigh) + easyMedium--; + else + mediumHigh--; + mediumSubmitted = true; + } + } + + if(high) { + high--; + highSubmitted = true; + } + else { + if(mediumHigh) { + mediumHigh--; + highSubmitted = true; + } + } + + if(!easySubmitted || !mediumSubmitted || !highSubmitted) + break; + + ++totalCompetiton; + } + + cout << totalCompetiton << '\n'; + return 0; +} \ No newline at end of file