CF98A 题解
题目传送门
思路
首先统计出每种字母出现的次数,然后将得到的序列非
- 当
A=\{6\} 时,X=1 。 - 当
A=\{1,5\} 时,X=1 。 - 当
A=\{2,4\} 时,X=2 。 - 当
A=\{3,3\} 时,X=2 。 - 当
A=\{1,1,4\} 时,X=2 。 - 当
A=\{1,2,3\} 时,X=3 。 - 当
A=\{2,2,2\} 时,X=6 。 - 当
A=\{1,1,1,3\} 时,X=5 。 - 当
A=\{1,1,2,2\} 时,X=8 。 - 当
A=\{1,1,1,1,2\} 时,X=15 。 - 当
A=\{1,1,1,1,1,1\} 时,X=30 。
AC CODE
#include<bits/stdc++.h>
using namespace std;
int read(){int x=0;char f=1,ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();return x*f;}
const int N=2e6+10;
char s[10];
int tong[128],ans[N];
int main(){
scanf("%s",s+1);
for(int i=1;i<=6;++i)
++tong[s[i]];
int a[]={0,tong['R'],tong['O'],tong['Y'],tong['G'],tong['B'],tong['V'],0,0};
sort(a+1,a+7);
int x=0;
for(int i=1;i<=6;++i)
x=x*10+a[i];
ans[6]=1;
ans[15]=1;
ans[24]=2;
ans[33]=2;
ans[114]=2;
ans[123]=3;
ans[222]=6;
ans[1113]=5;
ans[1122]=8;
ans[11112]=15;
ans[111111]=30;
printf("%d\n",ans[x]);
return 0;
}