标签:
1 #include "iostream" 2 #include "cstdio" 3 using namespace std; 4 const __int64 mod = 1e9 + 7; 5 int n; 6 char str[100010]; 7 int Count[5]; 8 9 __int64 bin(__int64 n, __int64 k) 10 { 11 __int64 res = 1; 12 while(k) { 13 if(k & 1) 14 res *= n, res %= mod; 15 n *= n; 16 n %= mod; 17 k >>= 1; 18 } 19 return res; 20 } 21 22 int main() 23 { 24 int i; 25 scanf("%d%s", &n, str + 1); 26 for(i = 1; i <= n; ++i) { 27 switch(str[i]) { 28 case ‘A‘: 29 ++Count[1]; 30 break; 31 case ‘C‘: 32 ++Count[2]; 33 break; 34 case ‘G‘: 35 ++Count[3]; 36 break; 37 case ‘T‘: 38 ++Count[4]; 39 } 40 } 41 int Max = max(max(Count[1], Count[2]), max(Count[3], Count[4])); 42 int Choice = 0; 43 for(i = 1; i <= 4; ++i) 44 if(Max == Count[i]) 45 ++Choice; 46 printf("%I64d\n", bin(Choice, n)); 47 }
标签:
原文地址:http://www.cnblogs.com/AC-Phoenix/p/4312198.html