結果

問題 No.293 4>7の世界
ユーザー fumi6328fumi6328
提出日時 2018-10-07 22:24:22
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 1,726 ms
コンパイル使用メモリ 166,880 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 12:42:59
合計ジャッジ時間 2,622 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'std::string jud()':
main.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
   16 | }
      | ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

string a,b;

string jud()
{
    for(int i = 0; i < a.length(); i++){
        if(a[i] != b[i]){
            if(a[i] == '4' && b[i] == '7') return a;
            if(a[i] == '7' && b[i] == '4') return b;
            if(a[i] > b[i]) return a;
            if(a[i] < b[i]) return b;
        }
    }
}

int main()
{
    cin >> a >> b;

    if(a.length() > b.length()) cout << a << endl;
    else if(a.length() < b.length()) cout << b << endl;
    else cout << jud() << endl;

    return 0;
}
0