結果
問題 | No.293 4>7の世界 |
ユーザー |
![]() |
提出日時 | 2019-11-18 22:05:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 652 bytes |
コンパイル時間 | 1,788 ms |
コンパイル使用メモリ | 166,284 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-02 10:36:40 |
合計ジャッジ時間 | 2,670 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i,n) for(int i = 0; i < (n);i++)#define sz(x) int(x.size())typedef long long ll;typedef pair<int,int> P;int main(){string a, b;cin >> a >> b;if (sz(a) != sz(b)) {cout << (sz(a) > sz(b) ? a : b) << endl;} else {rep(i,sz(a)) {int c1 = a[i] - '0', c2 = b[i] - '0';if (c1 == c2) continue;if (c1 == 4 && c2 == 7) {cout << a << endl;return 0;} else if (c1 == 7 && c2 == 4) {cout << b << endl;return 0;} else {cout << (c1 > c2 ? a : b) << endl;return 0;}}}return 0;}