Little Jay

[C++] 백준 2908번 상수 본문

알고리즘/BOJ

[C++] 백준 2908번 상수

Jay, Lee 2021. 3. 1. 01:26
#include <iostream>
using namespace std;

int calc(int i) {
  int a, b, c, d;
  a = i / 100;
  b = (i / 10) % 10;
  c = i % 10;
  d = a + b * 10 + c * 100;

  return d;
}

int main() {

  int a, b;
  cin >> a >> b;

  a = calc(a);
  b = calc(b);
  
  if (a > b) {
    cout << a << "\n";
  }
  else{
    cout << b << "\n";
  }

  return 0;
}
Comments