CodeForces - 520 C DNA Alignment——思路题

网友投稿 608 2022-11-28

CodeForces - 520 C DNA Alignment——思路题

CodeForces - 520 C DNA Alignment——思路题

#include #include #include #include using namespace std;typedef long long ll;const int mod = 1e9 + 7;const int maxn = 1e5 + 10;char str[maxn];int n, a[4];int main() { scanf("%d", &n); scanf("%s", str); for (int i = 0; i < n; i++) { if (str[i] == 'A') a[0]++; else if (str[i] == 'C') a[1]++; else if (str[i] == 'G') a[2]++; else if (str[i] == 'T') a[3]++; } int ans = 0; for (int i = 0; i < 4; i++) { ans = max(ans, a[i]); } int cnt = 0; for (int i = 0; i < 4; i++) { if (a[i] == ans) cnt++; } ans = 1; while (n) { if (n & 1) ans = (ll)ans * cnt % mod; cnt = (ll)cnt * cnt % mod; n >>= 1; } printf("%d\n", ans); return 0;}

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:CodeForces - 615B Best beautiful——简单dp
下一篇:UVA 10457 Magic Car——最小瓶颈路
相关文章

 发表评论

暂时没有评论,来抢沙发吧~