J - Cows and Poker Game

Insert picture description here
Insert picture description here

#include <iostream>
using namespace std;

int main()
{
    
    
    int n,sum1=0,sum2=0,sum3=0;;
	char a[222222];
    cin>>n;
    for(int i=1;i<=n;i++)
    {
    
    
    	 cin>>a[i];
    	 if(a[i]=='A')
    	 sum1++;
    	 if(a[i]=='F')
    	 sum2++;
    	 if(a[i]=='I')
    	 sum3++;
	}
   if(sum3==0)
   cout<<sum1<<endl;
   if(sum3==1)
   cout<<"1"<<endl;
   if(sum3>1)
   cout<<"0"<<endl;
    
    return 0;
}

The translation is OK.
Each player has three states: ALLIN or IN or FOLDED. When a player's state is not FOLDED, he can put his hand on the table, provided that the state of other players is FOLDED or ALLIN, (that is, when an IN appears When, there will only be this one on the table with a hand up)

Guess you like

Origin blog.csdn.net/weixin_51713993/article/details/114045504