結果

問題 No.293 4>7の世界
ユーザー k
提出日時 2020-06-04 08:33:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 822 bytes
コンパイル時間 1,979 ms
コンパイル使用メモリ 195,160 KB
最終ジャッジ日時 2025-01-10 21:07:45
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

const double PI = acos(-1);

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int a, b;
  cin >> a >> b;
  string x = to_string(a), y = to_string(b);

  if (x.length() > y.length())
    cout << x << endl;
  else if (x.length() < y.length())
    cout << y << endl;
  else {
    for (int i = 0; i < x.length(); i++) {
      if (x[i] == y[i]) continue;
      if (x[i] == '4' && y[i] == '7')
        cout << x << endl;
      else if (x[i] == '7' && y[i] == '4')
        cout << y << endl;
      else if (x[i] > y[i])
        cout << x << endl;
      else
        cout << y << endl;
      break;
    }
  }
  
  return 0;
}
0