只WA第二个点怎么办
查看原帖
只WA第二个点怎么办
400468
Aakkosetsumussa楼主2022/8/14 09:20
#include<bits/stdc++.h>
using namespace std;
int a[5];
struct node {
	int c;
	char h;
} e[5][1005];
string str;
int H[17]= {0,-50,-2,-3,-4,-5,-6,-7,-8,-9,-10,-20,-30,-40};
inline void cou() {
	for(int k=1; k<=4; k++) {
		if(e[k][1].c==0) {
			cout<<0<<" ";
			continue;
		}
		int ans=0,hcn=0,Cc=0,Sc=0,Dc=0;
		for(int i=1;; i++) {
			if(e[k][i].c==0) break;
			if(e[k][i].h=='H') {
				hcn++;
				ans+=H[e[k][i].c];
			}
			if(e[k][i].h=='C'&&e[k][i].c==10) Cc=1;
			if(e[k][i].h=='S'&&e[k][i].c==12) Sc=1;
			if(e[k][i].h=='D'&&e[k][i].c==11) Dc=1;
		}
		//cout<<endl<<"!%#%$@#$ "<<k<<" "<<Cc<<" "<<Sc<<" "<<Dc<<" "<<ans<<endl;
		if(hcn==13) {
			ans+=394;
			if(Sc==1&&Dc==1) ans+=300;
		} else {
			if(Sc==1) ans-=100;
			if(Dc==1) ans+=100;
		}
		if(e[k][2].c==0&&Cc==1) ans+=50;
		else if(Cc==1) ans*=2;
		if(ans>0) cout<<"+";
		cout<<ans<<" ";
	}
	cout<<endl;
}
int main() {
	while(true) {
		int mx=0;
		for(int j=1; j<=4; j++) {
			cin>>a[j];
			mx=max(mx,a[j]);
			for(int i=1; i<=a[j]; i++) {
				cin>>str;
				e[j][i].h=str[0];
				if(str.size()==2) e[j][i].c=str[1]-'0';
				else e[j][i].c=10*(str[1]-'0')+str[2]-'0';
			}
		}
		if(a[1]==0&&a[2]==0&&a[3]==0&&a[4]==0) break;
		cou();
		for(int i=1; i<=mx; i++)
			for(int j=1; j<=4; j++)
				e[j][i].c=0;
	}
	return 0;
}

这道题写了好久,wa第二个点,希望有高手帮助

2022/8/14 09:20
加载中...