반응형

문제 출처

https://www.acmicpc.net/problem/2908


소스코드

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
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
 
int reverse(int num) {
    int a = num / 100;
    int b = (num % 100/ 10;
    int c = num % 10;
    int ret = c * 100 + b * 10 + a;
    return ret;
}
int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
 
    int a, b;
    cin >> a >> b;
    a = reverse(a);
    b = reverse(b);
    if (a > b)
        cout << a;
    else
        cout << b;
    return 0;
}
cs


반응형

+ Recent posts