結果

問題 No.293 4>7の世界
ユーザー kyave3kyave3
提出日時 2015-10-23 22:43:40
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,197 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 88,364 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 07:24:30
合計ジャッジ時間 1,546 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <vector>
#include <map>
#include <climits>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <bitset>
#include <cstring>
#include <list>
#include <iterator>

#define REP(i, x, n) for(int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define EPS 1e-9
#define INF (1L << 30)
#define LINF (1LL << 60)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int calm(string str) {
	rep(i, str.size()) {
		if (str[i] == '4') str.replace(i, 1, "7");
		else if (str[i] == '7') str.replace(i, 1, "4");
	}
	return stoi(str);
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	string a, b;
	cin >> a >> b;
	if ((a.find("4") != string::npos && b.find("7") != string::npos)
		|| (a.find("7") != string::npos && b.find("4") != string::npos))
		cout << (calm(a) <= calm(b) ? b : a) << endl;
	else
		cout << max(stoi(a), stoi(b)) << endl;
	return 0;
}
0