救救蒟蒻……

P1148 拱猪计分

``` #include<iostream> using namespace std; int card[5]; bool MAP[5][17]; int point[17]={0,-50,-2,-3,-4,-5,-6,-7,-8,-9,-10,-20,-30,-40,-100,+100,0}; void print(int tmp) { if(tmp>0) cout<<'+'; cout<<tmp<<' '; } int main() { while(1) { for(int i=1;i<=4;i++) { for(int j=1;j<=16;j++) MAP[i][j]=false; } for(int i=1;i<=4;i++) { cin>>card[i]; for(int j=1;j<=card[i];j++) { char k;int p; cin>>k>>p; if(k=='H') MAP[i][p]=true; else if(k=='S') MAP[i][14]=true; else if(k=='D') MAP[i][15]=true; else if(k=='C') MAP[i][16]=true; } } if(card[1]+card[2]+card[3]+card[4]==0) break; for(int i=1;i<=4;i++) { int tmp=0; bool ah=true; for(int j=1;j<=13 && ah;j++) ah=MAP[i][j]; if(ah) { tmp=200; if(MAP[i][14] && MAP[i][15]) tmp=500; else tmp=tmp+MAP[i][14]*point[14]+MAP[i][15]*point[15]; if(MAP[i][16]) tmp*=2; print(tmp); } else { bool an=true; for(int j=1;j<=15 && an;j++) an=!MAP[i][j]; if(an) { if(MAP[i][16]) tmp=50; print(tmp); } else { for(int j=1;j<=15;j++) tmp=tmp+MAP[i][j]*point[j]; if(MAP[i][16]) tmp*=2; print(tmp); } } } cout<<endl; } return 0; } ```
by zhangruozhong @ 2021-06-14 19:29:20


不嫌弃的话就看看
by zhangruozhong @ 2021-06-14 19:29:44


掉头文件了,建议用万能,char和string不用头文件的吗,要有cstring
by zhanghaiyu @ 2021-07-09 08:51:32


@[zhanghaiyu](/user/515825) 还是50…………
by Meng142857 @ 2021-07-12 10:47:44


|