From bc572a48358828b89f92fe07ad453a3d0a1fa8fb Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Fri, 13 Sep 2024 17:46:52 +0900 Subject: [PATCH 1/3] =?UTF-8?q?2024-09-13=20=EB=8B=AC=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "oesnuj/\352\265\254\355\230\204/20207.cpp" | 42 +++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 "oesnuj/\352\265\254\355\230\204/20207.cpp" diff --git "a/oesnuj/\352\265\254\355\230\204/20207.cpp" "b/oesnuj/\352\265\254\355\230\204/20207.cpp" new file mode 100644 index 0000000..08b6bc3 --- /dev/null +++ "b/oesnuj/\352\265\254\355\230\204/20207.cpp" @@ -0,0 +1,42 @@ +#include +#include +using namespace std; + +struct EventPeriod +{ + int start, end; +}; + +int main() +{ + int N; + cin >> N; + vector v(N); + int days[365] = {0}; + + for(int i = 0; i < N; i++) + { + cin >> v[i].start >> v[i].end; //일정 시작일, 종료일 입력받기 + + for (int k = v[i].start - 1; k < v[i].end; k++) { + days[k]++; //일정에 포함되는 날의 배열 값 +1; + } + } + + int result = 0; + int height = 0, width = 0; + for (int i = 0; i < 365; i++) { + if (days[i] != 0) { + width++; + height = max(height, days[i]); + } + + if (days[i + 1] == 0) { + result += height * width; + width = 0; + height = 0; + } + } + cout << result; + return 0; +} \ No newline at end of file From 1319870771e6d0c80bc9998d1a82b9c89d347a45 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Fri, 13 Sep 2024 18:08:01 +0900 Subject: [PATCH 2/3] Update README.md --- oesnuj/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/oesnuj/README.md b/oesnuj/README.md index d0b1139..586d2a4 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -17,4 +17,5 @@ | 13차시 | 2024.07.28 | DP | [부녀회장이 될테야](https://www.acmicpc.net/problem/2775) | [#44](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/44) | | 14차시 | 2024.08.05 | 해시 | [ 나는야 포켓몬 마스터 이다솜 ](https://www.acmicpc.net/problem/1620) | [#46](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/46) | | 15차시 | 2024.08.10 | 그리디 | [ 주식 ](https://www.acmicpc.net/problem/11501) | [#47](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/47) | +| 16차시 | 2024.09.13 | 구현 | [ 달력 ](https://www.acmicpc.net/problem/20207) | [#50](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/50) | --- From 4c4777fb339b403b57f0565250107a0a25a078dd Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Sat, 21 Sep 2024 13:33:22 +0900 Subject: [PATCH 3/3] =?UTF-8?q?2024-09-21=20=ED=81=B0=20=EC=88=98=20A+B(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oesnuj/README.md | 1 + "oesnuj/\352\265\254\355\230\204/15353.cpp" | 34 +++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 "oesnuj/\352\265\254\355\230\204/15353.cpp" diff --git a/oesnuj/README.md b/oesnuj/README.md index 586d2a4..bcb7fbd 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -18,4 +18,5 @@ | 14차시 | 2024.08.05 | 해시 | [ 나는야 포켓몬 마스터 이다솜 ](https://www.acmicpc.net/problem/1620) | [#46](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/46) | | 15차시 | 2024.08.10 | 그리디 | [ 주식 ](https://www.acmicpc.net/problem/11501) | [#47](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/47) | | 16차시 | 2024.09.13 | 구현 | [ 달력 ](https://www.acmicpc.net/problem/20207) | [#50](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/50) | +| 17차시 | 2024.09.21 | 구현 | [ 큰 수 A+B(2) ](https://www.acmicpc.net/problem/15353) | [#52](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/52) | --- diff --git "a/oesnuj/\352\265\254\355\230\204/15353.cpp" "b/oesnuj/\352\265\254\355\230\204/15353.cpp" new file mode 100644 index 0000000..c7220ff --- /dev/null +++ "b/oesnuj/\352\265\254\355\230\204/15353.cpp" @@ -0,0 +1,34 @@ +#include +#include +#include + +using namespace std; + +string Add(string str1, string str2) +{ + string result = ""; + int i = str1.size() - 1; + int j = str2.size() - 1; + int carry = 0; + while (i >= 0 || j >= 0 || carry > 0) + { + int num1 = 0, num2 = 0; + if (i >= 0) + num1 = str1[i--] - '0'; + if (j >= 0) + num2 = str2[j--] - '0'; + + int sum = num1 + num2 + carry; + carry = sum / 10; + result = to_string(sum % 10) + result; + } + return result; +} + +int main() +{ + string a, b; + cin >> a >> b; + cout << Add(a, b); + return 0; +} \ No newline at end of file