結果

問題 No.293 4>7の世界
ユーザー alpha_virginisalpha_virginis
提出日時 2016-03-04 15:32:31
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 952 bytes
コンパイル時間 517 ms
コンパイル使用メモリ 68,020 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 19:46:08
合計ジャッジ時間 1,499 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,348 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 WA -
testcase_16 AC 2 ms
4,348 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <cassert>

int main() {

  std::string A, B;
  std::cin >> A >> B;

  // step 1
  if( A.size() != B.size() ) {
    if( A.size() < B.size() ) {
      std::cout << B << std::endl;
    }
    if( A.size() > B.size() ) {
      std::cout << A << std::endl;
    }
    return 0;
  }

  // step 2
  assert( A.size() == B.size() );
  for(int i = 0; i < (int)A.size(); ++i) {
    if( A[i] != B[i] ) {
      if( A[i] == '4' and B[i] == '7' ) {
        std::cout << A << std::endl;
      }
      else if( A[i] == '7' and B[i] == '4' ) {
        std::cout << B << std::endl;
      }
      else {
        if( A[i] < B[i] ) {
          std::cout << B[i] << std::endl;
        }
        else if( A[i] > B[i] ) {
          std::cout << A[i] << std::endl;
        }
      }
      return 0;
    }
  }
  
  return 0;
}
0