結果
問題 | No.293 4>7の世界 |
ユーザー |
![]() |
提出日時 | 2016-07-09 04:01:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 754 ms |
コンパイル使用メモリ | 64,756 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 12:09:44 |
合計ジャッジ時間 | 2,075 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <string>#include <iostream>using namespace std;bool comp(int a, int b) {if ((a == '4' || a == '7') &&(b == '4' || b == '7')) {return a < b;}return a > b;}string comp(const string& a, const string& b) {if (a.size() > b.size()) return a;if (a.size() < b.size()) return b;for (size_t i = 0; i < a.size(); i++) {if (comp(a[i], b[i])) return a;if (comp(b[i], a[i])) return b;}return a;}int main(void) {string a, b;cin >> a >> b;cout << comp(a, b) << endl;}