哪里错了呀,求解
  • 板块灌水区
  • 楼主yubaolai
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/5/28 21:29
  • 上次更新2024/5/29 11:43:32
查看原帖
哪里错了呀,求解
1163610
yubaolai楼主2024/5/28 21:29

题目

#include <bits/stdc++.h>
using namespace std;

char s;
int a[20][20],num[50],rear[50],co;

int abc(int x){
	++num[x];
	if(a[x][rear[x]]!=13&&x!=13)
		return abc(a[x][--rear[x]]);
	else
		if(a[x][rear[x]]==13)
			--rear[x];
	return 0;
}

int main(){
	freopen("diyz.in","r",stdin);
	freopen("diyz.out","w",stdout);
	for(int i=1;i<=13;i++)
		rear[i]=5;
	for(int i=1;i<=13;i++){
		int t=0;
		for(int j=1;j<=8;j++){
			scanf("%c",&s);
			if(j%2!=0){
				if(s=='A'||s=='J'||s=='Q'||s=='K'||s=='0'){
					if(s=='A')
						a[i][++t]=1;
					if(s=='J')
						a[i][++t]=11;
					if(s=='Q')
						a[i][++t]=12;
					if(s=='K')
						a[i][++t]=13;
					if(s=='0')
						a[i][++t]=10;
					}
				else
					a[i][++t]=s-'0';
				}				
			}
		}
	while(num[13]<4){
		abc(a[13][num[13]+1]);
		}
	for(int i=1;i<=12;i++)
		if(num[i]==4)
			co++;
	printf("%d",co);
	return 0;
} 
2024/5/28 21:29
加载中...