結果

問題 No.632 穴埋め門松列
ユーザー stderrstderr
提出日時 2018-02-02 15:54:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,155 bytes
コンパイル時間 481 ms
コンパイル使用メモリ 61,936 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-09 21:36:33
合計ジャッジ時間 1,015 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
#define ll long long
using namespace std;

bool is_kadomatu(int a1, int a2, int a3) {
  return (a1 != a2 && a2 != a3 && a3 != a1) && ((a2 >= a1 && a2 >= a3) || (a2 <= a1 && a2 <= a3));
}

int main() {
  int c1 = 0, c2 = 0, c3 = 0;
  int pos;
  string s;
  cin >> s;
  if (s != "?") c1 = stoi(s);
  else pos = 1;
  cin >> s;
  if (s != "?") c2 = stoi(s);
  else pos = 2;
  cin >> s;
  if (s != "?") c3 = stoi(s);
  else pos = 3;

  string result = "";
  if (pos == 1) {
    if (is_kadomatu(1, c2, c3)) result += "1";
    if (is_kadomatu(4, c2, c3)) result += "4";
  } else if (pos == 2) {
    if (is_kadomatu(c1, 1, c3)) result += "1";
    if (is_kadomatu(c1, 4, c3)) result += "4";
  } else if (pos == 3) {
    if (is_kadomatu(c1, c2, 1)) result += "1";
    if (is_kadomatu(c1, c2, 4)) result += "4";
  } else {
    cout << "error" << endl;
  }
  cout << result << endl;
  return 0;
}
0