結果
問題 | No.293 4>7の世界 |
ユーザー |
|
提出日時 | 2015-10-23 22:31:50 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 640 bytes |
コンパイル時間 | 571 ms |
コンパイル使用メモリ | 60,732 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 11:01:48 |
合計ジャッジ時間 | 1,429 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <iostream>#include <cstdio>#include <vector>#include <algorithm>#include <utility>#include <string>using namespace std;int main() {string a, b;cin >> a >> b;if (a == b) {cout << a << endl;} else if (a.size() > b.size()) {cout << a << endl;} else if (a.size() < b.size()) {cout << b << endl;} else {for (int i = 0; i < a.size(); i++) {if (a[i] == '4' && b[i] == '7') {cout << a << endl;break;} else if (a[i] == '7' && b[i] == '4') {cout << b << endl;break;} else if (a[i] != b[i]) {cout << (a[i] > b[i] ? a : b) << endl;break;}}}return 0;}