除过顺子的那些带牌和单打,可以直接算出来,得到一个答案的上界。
搜索时候只要找顺子,顺带剪几个枝就行了。
交上去rank1,吓傻。
/* Pigonometry */
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 18;
int n, a[maxn], cnt[5], ans;
inline int iread() {
int f = 1, x = 0; char ch = getchar();
for(; ch < '0' || ch > '9'; ch = getchar()) f = ch == '-' ? -1 : 1;
for(; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
return f * x;
}
inline int calc(int x[]) {
memset(cnt, 0, sizeof(cnt));
int res = 0;
for(int i = 0; i < maxn; i++) cnt[x[i]]++;
while(cnt[4] && cnt[2]