比赛 NOIP水题争霸赛 评测结果 AAAAAAAAAA
题目名称 打扑克 最终得分 100
用户昵称 Joker 运行时间 0.009 s
代码语言 C++ 内存使用 0.37 MiB
提交时间 2018-02-11 19:51:33
显示代码纯文本
#include <bits/stdc++.h>
#define ll long long
#define f(i,a,b) for(register int i = a; i <= b; ++i)
#define max(a,b) (a)>(b)?(a):(b)
#define min(a,b) (a)<(b)?(a):(b)
using namespace std;
int c[10001], a[10001];
inline char get_char()
{
	static char buf[27860], *p1=buf, *p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,27860,stdin),p1==p2)?EOF:*p1++;
}
inline int read()
{
	int x = 0, f = 0; char ch = get_char();
	while(ch < '0'||ch > '9') {f|=(ch=='-'); ch = get_char();}
	while(ch >= '0'&&ch <= '9') {x = (x<<3) + (x<<1) + (ch^48); ch = get_char();}
	return f?-x:x;
}
int main()
{
	freopen("poker1.in", "r", stdin);
	freopen("poker1.out", "w", stdout);
	register int T=read(), cnt, ans, n, x;
	while(T--)
	{
		memset(c, 0, sizeof(c)); memset(a, 0 , sizeof a);
		n = read(); cnt = 0, ans = 0; bool f = false, cc = false;
		f(i,1,n) {x = read(); ++a[x];}
		for(register int i = 1; i <= 13; ++i)
		{
			if(a[i] > 4) {printf("cheat\n"); f = true; break;}
			if(a[i] == 4) {c[++cnt] = i;}
		}
		if(f) continue;
		if(!cnt) {printf("no bomb\n"); continue;}
		for(register int i = 1; i <= cnt; ++i)
		{
			if(c[i] == 3|| ans == 3) {printf("3\n"); cc = true; break;}
			if(!ans) {ans = c[i]; continue;}
			if(c[i] > 3) {if(ans > 3) ans = min(ans, c[i]); else {ans = c[i];}}
			if(c[i] < 3) {if(ans > 3) continue; else ans = max(ans, c[i]);}
		}
		if(!cc) printf("%d\n", ans); 
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}