結果

問題 No.293 4>7の世界
ユーザー wahr69
提出日時 2015-11-05 13:45:06
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 695 ms
コンパイル使用メモリ 57,444 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 12:40:13
合計ジャッジ時間 1,386 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 6 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
string s1;
string s2;

cin >> s1 >> s2;

if (s1.length() > s2.length()) {
 cout << s1 << endl;
} else if (s1.length() < s2.length()) {
 cout << s2 << endl;
}

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

}
0