結果

問題 No.293 4>7の世界
ユーザー koyumeishi
提出日時 2015-10-23 22:26:48
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 779 ms
コンパイル使用メモリ 74,048 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 10:59:27
合計ジャッジ時間 1,722 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <set>
using namespace std;

int main(){
	string a,b;
	cin >> a >> b;
	if(a.size() != b.size()){
		cout << (a.size()>b.size()?a:b) << endl;
		return 0;
	}

	for(int i=0; i<a.size(); i++){
		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[i] > b[i]?a:b) << endl;
			return 0;
		}
	}
	return 0;
}
0