結果
| 問題 | No.293 4>7の世界 | 
| コンテスト | |
| ユーザー |  Yut176 | 
| 提出日時 | 2017-07-24 14:00:25 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 1,054 bytes | 
| コンパイル時間 | 1,212 ms | 
| コンパイル使用メモリ | 96,400 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-30 12:29:30 | 
| 合計ジャッジ時間 | 2,021 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 20 | 
ソースコード
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<random>
#include<stack>
#include<queue>
#include<cassert>
using namespace std;
int inf = 1000000000;
string sp(string a){
  for(int i=0; i<a.size(); i++){
    if( a[i] == '7' ) a[i] = '4';
    else if( a[i] == '4' ) a[i] = '7';
  }
  return a;
}
int main(void) {
  string a, b;
  cin >> a >> b;
  if( a.size() > b.size() ) cout << a << endl;
  else if( a.size() < b.size() ) cout << b << endl;
  else{
    for(int i=0; i<a.size(); i++){
      if( a[i] == b[i] ) continue;
      else if( (a[i] == '4' || a[i] == '7') && ( b[i] == '4' || b[i] == '7' ) ){
        if( a[i] == '4' ){
          cout << a << endl;
          return 0;
        }else{
          cout << b << endl;
          return 0;
        }
      }else{
        if( a[i] > b[i] ) cout << a << endl;
        else cout << b << endl;
        return 0;
      }
    }
    cout << a << endl;
  }
  return 0;
}
            
            
            
        