結果

問題 No.632 穴埋め門松列
ユーザー ut0sut0s
提出日時 2019-08-29 21:33:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 787 bytes
コンパイル時間 1,673 ms
コンパイル使用メモリ 169,808 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 21:12:28
合計ジャッジ時間 2,161 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
  @file 632.cpp
  @title  No.632 穴埋め門松列 - yukicoder
  @url https://yukicoder.me/problems/no/632
**/

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, N) for (int i = 0; i < (N); ++i)

bool check_kado(string s) {
  vector<int> kado(3, 0);
  REP(i, 3) {
    kado[i] = stoi(s.substr(i, 1));
  }
  return (kado[1] == *max_element(ALL(kado)) || kado[1] == *min_element(ALL(kado)));
}

int main() {
  string c = "";
  string tmp;
  REP(i, 3) {
    cin >> tmp;
    c += tmp;
  }
  const string c_org = c;

  replace(ALL(c), '?', '1');
  if (check_kado(c)) {
    cout << "1";
  }

  c = c_org;
  replace(ALL(c), '?', '4');
  if (check_kado(c)) {
    cout << "4";
  }
  cout << endl;

  return 0;
  }
0