Skip to content

Commit

Permalink
Merge pull request #52 from AlgoLeadMe/17-oesnuj
Browse files Browse the repository at this point in the history
17-oesnuj
  • Loading branch information
oesnuj authored Oct 7, 2024
2 parents a638f5d + 4c4777f commit 85daad0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions oesnuj/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
---
34 changes: 34 additions & 0 deletions oesnuj/κ΅¬ν˜„/15353.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <iostream>
#include <string>
#include <vector>

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;
}

0 comments on commit 85daad0

Please sign in to comment.