結果

問題 No.293 4>7の世界
ユーザー chakku
提出日時 2016-03-17 01:24:03
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 690 bytes
コンパイル時間 789 ms
コンパイル使用メモリ 60,788 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 11:57:48
合計ジャッジ時間 2,054 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

typedef long long ll;

int main(){
	string A, B;
	cin >> A >> B;
	if (A == B){
		cout << A << endl;
		return 0;
	}
	if (A.length() != B.length()){
		if (A.length() > B.length()){
			cout << A << endl;
			return 0;
		}
		else{
			cout << B << endl;
			return 0;
		}
	}

	for (int i = 0; i < A.length(); i++){
		if (A[i] == B[i]) continue;
		if (A[i] == '4' && B[i] == '7'){
			cout << A << endl;
			return 0;
		} else if (A[i] == '7' && B[i] == '4'){
			cout << B << endl;
			return 0;
		} else{
			if (A[i]>B[i]) cout << A << endl;
			else cout << B << endl;
			return 0;
		}
	}
	return 0;
}
0