結果

問題 No.832 麻雀修行中
ユーザー 夜
提出日時 2020-11-30 14:01:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 1,296 bytes
コンパイル時間 864 ms
コンパイル使用メモリ 95,164 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-11 02:50:02
合計ジャッジ時間 4,521 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int co[10] = {};
bool bo = false;
void m(vector<int> v) {
	int co1 = 0;
	for (int i = 1; i <= 9; i++) {
		co1 += v[i];
	}
	if (co1 == 12) {
		for (int i = 1; i <= 9; i++) {
			v[i] += 2;
			bool bo1 = true;
			for (int j = 1; j <= 9; j++) {
				if (v[j] != co[j]) {
					bo1 = false;
				}
			}
			if (bo1) {
				bo = true;
			}
			v[i] -= 2;
		}
		return;
	}
	for (int i = 1; i <= 9; i++) {
		v[i] += 3;
		m(v);
		v[i] -= 3;
	}
	for (int i = 1; i <= 7; i++) {
		v[i]++;
		v[i + 1]++;
		v[i + 2]++;
		m(v);
		v[i]--;
		v[i + 1]--;
		v[i + 2]--;
	}
}
int main() {
	string s;
	cin >> s;
	for (int i = 0; i < 13; i++) {
		co[int(s[i] - '0')]++;
	}
	for (int i = 1; i <= 9; i++) {
		bo = false;
		if (co[i] != 4) {
			co[i]++;
			vector<int> vec(10);
			for (int j = 1; j <= 9; j++) {
				vec[j] = 0;
			}
			m(vec);
			int co2 = 0;
			for (int j = 1; j <= 9; j++) {
				if (co[j] == 2) {
					co2++;
				}
			}
			if (co2 == 7) {
				bo = true;
			}
			co[i]--;
			if (bo) {
				cout << i << endl;
			}
		}
	}
}
0