結果
問題 | No.293 4>7の世界 |
ユーザー |
|
提出日時 | 2020-04-13 21:48:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 732 bytes |
コンパイル時間 | 691 ms |
コンパイル使用メモリ | 67,708 KB |
最終ジャッジ日時 | 2025-01-09 18:13:14 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <iostream>#include <string>int cmp(char lhs, char rhs) {if (lhs == '4' && rhs == '7') return 1;if (lhs == '7' && rhs == '4') return -1;return (lhs == rhs ? 0 : lhs < rhs ? -1 : 1);}void solve() {std::string a, b;std::cin >> a >> b;if (a.length() != b.length()) {std::cout << (a.length() > b.length() ? a : b)<< std::endl;return;}int n = a.length();for (int i = 0; i < n; ++i) {int res = cmp(a[i], b[i]);if (res == 0) continue;std::cout << (res > 0 ? a : b) << std::endl;return;}}int main() {std::cin.tie(nullptr);std::ios::sync_with_stdio(false);solve();return 0;}