其他分享
首页 > 其他分享> > Pocket Book CodeForces - 152C

Pocket Book CodeForces - 152C

作者:互联网

原题链接
考察:思维
看题目:woc好复杂
看大佬题解:我果然zz
思路:
  如果要想的话需要分解到每一位考虑,第i位有几种可能,然后累乘.可以发现第i位的可能数就是第i位字母种数.

Code

#include <iostream>
#include <cstring>
using namespace std;
typedef long long LL;
const int N = 110,M = 1000000007,S = 30;
int n,m,sz[N];
bool st[N][S];
char s[N];
int main()
{
	scanf("%d%d",&n,&m); 
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s+1);
		for(int j=1;j<=m;j++)
		  if(!st[j][s[j]-'a'])
		  {
		  	sz[j]++;
		  	st[j][s[j]-'a'] = 1;
		  }
	}
	int res = 1;
	for(int i=1;i<=m;i++)
	  res = (LL)res*sz[i]%M;
	printf("%d\n",res);
	return 0;
}

标签:原题,int,题解,namespace,CodeForces,long,Pocket,Book,include
来源: https://www.cnblogs.com/newblg/p/15027471.html