結果

問題 No.293 4>7の世界
ユーザー a01sa01to
提出日時 2025-02-21 00:09:51
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 712 bytes
コンパイル時間 3,089 ms
コンパイル使用メモリ 275,008 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-02-21 00:09:56
合計ジャッジ時間 4,214 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  string a, b;
  cin >> a >> b;
  if (a.size() != b.size()) {
    cout << (a.size() > b.size() ? a : b) << endl;
  }
  else {
    rep(i, a.size()) {
      if (a[i] != b[i]) {
        if (a[i] == '4' && b[i] == '7') {
          cout << a << endl;
        }
        else if (a[i] == '7' && b[i] == '4') {
          cout << b << endl;
        }
        else {
          cout << (a[i] > b[i] ? a : b) << endl;
        }
        break;
      }
    }
  }
  return 0;
}
0