結果

問題 No.632 穴埋め門松列
ユーザー SotaSota
提出日時 2024-02-08 12:35:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,407 bytes
コンパイル時間 1,066 ms
コンパイル使用メモリ 100,576 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-08 12:35:40
合計ジャッジ時間 1,756 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES

#include <iostream>		//cin, cout
#include <vector>		//vector
#include <algorithm>	//sort,min,max,count
#include <string>		//string,getline, to_string
#include <cstdlib>		//abs(int)
#include <utility>		//swap, pair
#include <tuple>        //tuple
#include <deque>		//deque
#include <climits>		//INT_MAX
#include <bitset>		//bitset
#include <cmath>		//sqrt, ceil. M_PI, pow, sin
#include <ios>			//fixed
#include <iomanip>		//setprecision
#include <sstream>		//stringstream
#include <numeric>		//gcd, assumlate
#include <random>		//randam_device
#include <limits>		//numeric_limits

using namespace std;
constexpr long long int D_MOD = 1000000007;

inline bool JudgeKadomatsu(int a, int b, int c) {
	//門松列か判定する

	if (a == b || b == c || c == a) {
		return false;
	}
	if (b == max({ a, b, c }) || b == min({ a, b, c })) {
		return true;
	}
	else {
		return false;
	}
}

int main() {

	string S, T;
	char c;
	
	for (int i = 0; i < 3; i++) {
		cin >> c;
		S.push_back(c);
	}

	T = S;
	for (int i = 0; i < 3; i++) {
		if (T.at(i) == '?') {
			T.at(i) = '1';
		}
		break;
	}
	if (JudgeKadomatsu(T.at(0) - '0', T.at(1) - '0', T.at(2) - '0')) {
		cout << 1;
	}

	T = S;
	for (int i = 0; i < 3; i++) {
		if (T.at(i) == '?') {
			T.at(i) = '4';
		}
		break;
	}
	if (JudgeKadomatsu(T.at(0) - '0', T.at(1) - '0', T.at(2) - '0')) {
		cout << 4;
	}

	cout << endl;

	return 0;

}
0