結果
| 問題 | No.293 4>7の世界 |
| コンテスト | |
| ユーザー |
kichirb3
|
| 提出日時 | 2018-03-28 17:00:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,097 bytes |
| 記録 | |
| コンパイル時間 | 717 ms |
| コンパイル使用メモリ | 68,480 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 12:37:01 |
| 合計ジャッジ時間 | 1,901 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
// No.293 4>7の世界
// https://yukicoder.me/problems/no/293
//
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
class number {
public:
string val;
bool operator<(number other) {
if (val.size() > other.val.size())
return false;
if (val.size() < other.val.size())
return true;
for (auto i = 0; i < val.size(); ++i) {
if (val[i] != other.val[i]) {
if (val[i] == '4' && other.val[i] == '7' || val[i] == '7' && other.val[i] == '4')
return !(val[i] < other.val[i]);
else
return val[i] < other.val[i];
}
}
return false;
}
};
template<typename CharT, typename Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, number& s) {
os << s.val;
return os;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
number A, B;
cin >> A.val >> B.val;
if (A < B)
cout << B << endl;
else
cout << A << endl;
}
kichirb3