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