1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include <iostream> #include <string> using namespace std; int main(void) { int A, B; cin >> A; cin >> B; string sA, sB; sA = to_string(A); sB = to_string(B); string sA2 = ""; string sB2 = ""; for(int i=sA.length()-1; i>=0; i--) { sA2.append(1, sA.at(i)); } for(int i=sB.length()-1; i>=0; i--) { sB2.append(1, sB.at(i)); } int newA, newB; newA = stoi(sA2); newB = stoi(sB2); if(newA > newB) cout << newA << endl; else cout << newB << endl; return 0; } | cs |
'C & C++ > Baekjoon' 카테고리의 다른 글
백준 2941 - 크로아티아 알파벳 (0) | 2017.12.27 |
---|---|
백준 2920 - 음계 (0) | 2017.12.27 |
백준 2839 - 설탕 배달 (0) | 2017.12.27 |
백준 2742 - 기찍 N (0) | 2017.12.27 |
백준 2741 - N 찍기 (0) | 2017.12.27 |