알고리즘 문제풀이
[백준/BOJ] 백준 2908번 : 상수
GeniusJo
2020. 9. 15. 20:35
2908번: 상수
상근이의 동생 상수는 수학을 정말 못한다. 상수는 숫자를 읽는데 문제가 있다. 이렇게 수학을 못하는 상수를 위해서 상근이는 수의 크기를 비교하는 문제를 내주었다. 상근이는 세 자리 수 두 �
www.acmicpc.net
입력된 숫자(문자열)를 뒤집어서 문자를 해결한다.
코드
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
cin.tie(NULL);
ios_base::sync_with_stdio(false);
string a, b;
cin >> a >> b;
//입력된 숫자(문자열)를 뒤집는다.
reverse(a.begin(), a.end());
reverse(b.begin(), b.end());
if (a > b)
cout << a;
else
cout << b;
return 0;
}