题意:
恶心,给定 字符串 S,找到一个串T 使得 那个值最大
思路:
要使得 这个值最大,我们可以推出来(自己算算),另一个串的所有数字跟 S 串中,出现次数最到的字符一样就是了,,
如果S中出现次数最多的字符不止一种,那 另一个串中所有的字符只要是这些出现次数最多的就行了
所以串T中 每个位置的选择种数 就是S串中出现次数最多的字符 的种类数,,最后求个快速幂
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<stack>
#include<map>
#define PI acos(-1.0)
#define in freopen("in.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 1e5 + 7, maxd = 20 + 7, mod = 1e9 + 7;
const int INF = 0x7f7f7f7f;
int n;
string s, t = "ATGC";
map<char, ll> mp;
ll max_ = -1, cnt, ans = 1;
int main() {
ios::sync_with_stdio(0);
cin >> n >> s;
for(int i = 0; i < n; ++i)
mp[s[i]]++;
for(int i = 0; i < 4; ++i) {
if(mp[t[i]] == max_) {
cnt++;
}
else if(mp[t[i]] > max_) {
max_ = mp[t[i]];
cnt = 1;
}
}
while(n) {
if(n & 1) ans *= cnt;
ans %= mod;
n >>= 1;
cnt = (cnt*cnt % mod);
}
cout << ans << endl;
return 0;
}