結果
| 問題 |
No.293 4>7の世界
|
| コンテスト | |
| ユーザー |
ty70
|
| 提出日時 | 2015-12-14 16:55:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 852 bytes |
| コンパイル時間 | 738 ms |
| コンパイル使用メモリ | 56,184 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 11:34:45 |
| 合計ジャッジ時間 | 1,425 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <iostream>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
using namespace std;
typedef long long ll;
bool ismatch(char c){
return (c == '4' || c == '7');
}
string cmp(string s, string t){
if (s.length() != t.length()){
if (s.length() > t.length())
return s;
else
return t;
}else{
int n = s.length();
rep (i, n){
if (s[i] == t[i]) continue;
if (ismatch(s[i]) && ismatch(t[i])){
if(s[i] == '4' && t[i] == '7'){
return s;
}else{ // if (s[i] == '7' && t[i] == '4')
return t;
} // end if
}else{
if (s[i] > t[i])
return s;
else
return t;
} // end if
} // end rep
return s;
} // end if
return "";
}
int main()
{
ios_base::sync_with_stdio(0);
string a, b; cin >> a >> b;
string res = cmp(a,b);
cout << res << endl;
return 0;
}
ty70