Algorithm ๐ง๐ป๐ป/๋ฐฑ์ค(BOJ)
[๋ฐฑ์ค,c++] 1357๋ฒ - ๋ค์งํ ๋ง์
dkswnkk
2021. 11. 4. 22:55
1357๋ฒ: ๋ค์งํ ๋ง์
์ด๋ค ์ X๊ฐ ์ฃผ์ด์ก์ ๋, X์ ๋ชจ๋ ์๋ฆฌ์๊ฐ ์ญ์์ด ๋ ์๋ฅผ ์ป์ ์ ์๋ค. Rev(X)๋ฅผ X์ ๋ชจ๋ ์๋ฆฌ์๋ฅผ ์ญ์์ผ๋ก ๋ง๋๋ ํจ์๋ผ๊ณ ํ์. ์๋ฅผ ๋ค์ด, X=123์ผ ๋, Rev(X) = 321์ด๋ค. ๊ทธ๋ฆฌ๊ณ , X=100์ผ ๋, Rev(
www.acmicpc.net
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
string x, y, temp;
cin >> x >> y;
reverse(x.begin(), x.end());
reverse(y.begin(), y.end());
temp = to_string(stoi(x) + stoi(y));
reverse(temp.begin(), temp.end());
cout << stoi(temp);
}