Language: C++


#include <stdio.h>
 


long long int minx(long long int v[],int n){
	int i,j,k;
	long long int tmp;
	tmp=v[0];
	for(i=1;i<=n-1;i++){
		if(tmp>v[i])
		tmp=v[i];}
		return tmp;}
int maxx(int v[],int n){
	int i,j,k,tmp;
	tmp=v[0];
	for(i=1;i<=n-1;i++){
		if(tmp<v[i])
		tmp=v[i];}
		return tmp;}
int max(int n1,int n2,int n3){
	int tmp;
	tmp=n1;
	if(n2>tmp)
	tmp=n2;
	if(n3>tmp)
	tmp=n3;
	return tmp;}
int max2(int n1,int n2){
	int tmp;
	tmp=n1;
	if(n2>tmp)
	tmp=n2;
	return tmp;}
int min3(int n1,int n2,int n3){
	int tmp;
	tmp=n1;
	if(n2<tmp)
	tmp=n2;
	if(n3<tmp)
	tmp=n3;
	return tmp;}
int min2(int n1,int n2){
	int tmp;
	tmp=n1;
	if(n2<tmp)
	tmp=n2;
	return tmp;}
long long int abs(long long int n){
	if(n>=0)
	return n;
	else return(-1)*n;
}
int main(void)
{int N,A,M,B,j,i,k,H,W,l,nM,nA,nR,nC,nH,flag;
	long long int sum,min;
	sum=1;
	scanf("%d",&N);
	char S[100000][10];
	nM=0;
	nA=0;
	nR=0;
	nC=0;
	nH=0;
	for(i=0;i<=N-1;i++){
		scanf("%s",&S[i]);}
	for(j=0;j<=N-1;j++){
		if(S[j][0]=='M'){
		nM+=1;}
		else if(S[j][0]=='A'){
		nA+=1;}
		else if(S[j][0]=='R'){
		nR+=1;}
		else if(S[j][0]=='C'){
		nC+=1;}
		else if(S[j][0]=='H'){
		nH+=1;}
		
		}
	int A[5]={nM,nA,nR,nC,nH};
	int B[5];
	k=0;
	for(i=0;i<=4;i++){
		if(A[i]!=0){
			B[k]=A[i];
			k+=1;}}
	if(k<3)
	printf("0");
	else if(k==3){
		sum=B[0]*B[1]*B[2];
		printf("%lld",sum);}
		else if(k==4){
			sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3];
			printf("%lld",sum);}
			else if(k==5){
				sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
				printf("%lld",sum);}
	
	



	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:80:13: error: conflicting declaration 'int A [5]'
   80 |         int A[5]={nM,nA,nR,nC,nH};
      |             ^
a.cc:55:8: note: previous declaration as 'int A'
   55 | {int N,A,M,B,j,i,k,H,W,l,nM,nA,nR,nC,nH,flag;
      |        ^
a.cc:81:13: error: conflicting declaration 'int B [5]'
   81 |         int B[5];
      |             ^
a.cc:55:12: note: previous declaration as 'int B'
   55 | {int N,A,M,B,j,i,k,H,W,l,nM,nA,nR,nC,nH,flag;
      |            ^
a.cc:84:21: error: invalid types 'int[int]' for array subscript
   84 |                 if(A[i]!=0){
      |                     ^
a.cc:85:26: error: invalid types 'int[int]' for array subscript
   85 |                         B[k]=A[i];
      |                          ^
a.cc:85:31: error: invalid types 'int[int]' for array subscript
   85 |                         B[k]=A[i];
      |                               ^
a.cc:90:22: error: invalid types 'int[int]' for array subscript
   90 |                 sum=B[0]*B[1]*B[2];
      |                      ^
a.cc:90:27: error: invalid types 'int[int]' for array subscript
   90 |                 sum=B[0]*B[1]*B[2];
      |                           ^
a.cc:90:32: error: invalid types 'int[int]' for array subscript
   90 |                 sum=B[0]*B[1]*B[2];
      |                                ^
a.cc:93:30: error: invalid types 'int[int]' for array subscript
   93 |                         sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3];
      |                              ^
a.cc:93:35: error: invalid types 'int[int]' for array subscript
   93 |                         sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3];
      |                                   ^
a.cc:93:40: error: invalid types 'int[int]' for array subscript
   93 |                         sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3];
      |                                        ^
a.cc:93:45: error: invalid types 'int[int]' for array subscript
   93 |                         sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3];
      |                                             ^
a.cc:93:50: error: invalid types 'int[int]' for array subscript
   93 |                         sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3];
      |                                                  ^
a.cc:93:55: error: invalid types 'int[int]' for array subscript
   93 |                         sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3];
      |                                                       ^
a.cc:93:60: error: invalid types 'int[int]' for array subscript
   93 |                         sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3];
      |                                                            ^
a.cc:93:65: error: invalid types 'int[int]' for array subscript
   93 |                         sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3];
      |                                                                 ^
a.cc:93:70: error: invalid types 'int[int]' for array subscript
   93 |                         sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3];
      |                                                                      ^
a.cc:93:75: error: invalid types 'int[int]' for array subscript
   93 |                         sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3];
      |                                                                           ^
a.cc:93:80: error: invalid types 'int[int]' for array subscript
   93 |                         sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3];
      |                                                                                ^
a.cc:93:85: error: invalid types 'int[int]' for array subscript
   93 |                         sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3];
      |                                                                                     ^
a.cc:96:38: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                      ^
a.cc:96:43: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                           ^
a.cc:96:48: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                ^
a.cc:96:53: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                     ^
a.cc:96:58: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                          ^
a.cc:96:63: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                               ^
a.cc:96:68: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                                    ^
a.cc:96:73: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                                         ^
a.cc:96:78: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                                              ^
a.cc:96:83: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                                                   ^
a.cc:96:88: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                                                        ^
a.cc:96:93: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                                                             ^
a.cc:96:98: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                                                                  ^
a.cc:96:103: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                                                                       ^
a.cc:96:108: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                                                                            ^
a.cc:96:113: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                                                                                 ^
a.cc:96:118: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |                                                                                                                      ^
a.cc:96:123: error: invalid types 'int[int]' for array subscript
   96 |                                 sum=B[0]*B[1]*B[2]+B[0]*B[1]*B[3]+B[0]*B[2]*B[3]+B[1]*B[2]*B[3]+B[0]*B[1]*B[4]+B[0]*B[2]*B[4]+B[0]*B[3]*B[4]+B[1]*B[2]*B[4]+B[1]*B[3]*B[4]+B[2]*B[3]*B[4];
      |