結果

問題 No.293 4>7の世界
ユーザー fushime2fushime2
提出日時 2018-01-10 12:07:30
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,120 bytes
コンパイル時間 1,167 ms
コンパイル使用メモリ 146,780 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-25 03:27:59
合計ジャッジ時間 2,923 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 RE -
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 RE -
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 2 ms
4,380 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }

bool f(int x, int y) {
    if (x == 4 && y == 7 || x == 7 && y == 4) {
        swap(x, y);
    }
    return x > y;
}

int main() {
    string a, b; cin >> a >> b;
    if (a.size() != b.size()) {
        cout << (a.size() > b.size() ? a : b) << "\n";
        return 0;
    }
    if (a == "0" || b == "0") {
        cout << (a == "0" ? b : a) << "\n";
        return 0;
    }

    string aa = a, bb = b;
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    int x = stoi(a), y = stoi(b);
    while (x) {
        int b1 = x % 10, b2 = y % 10;
        x /= 10; y /= 10;
        if (b1 == b2) continue;
        cout << (f(b1, b2) ? aa : bb) << "\n";
        break;
    }

    return 0;
}
0