Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
18963 | 孙文谦 | 基因组分析 | C++ | 通过 | 100 | 193 MS | 7948 KB | 853 | 2021-05-03 08:37:55 |
#include <cstdio> #include <cstring> #include <cmath> #include <cctype> #include <iostream> #include <algorithm> #include <map> #include <set> #include <vector> #include <string> #include <stack> #include <queue> typedef long long LL; using namespace std; int n, k, r; char s[] = "ATCG"; char str[100005]; int main() { scanf("%d %d %d", &n, &k, &r); if(k > n) {printf("0\n"); return 0;} str[1] = s[r % 4]; for (int i = 2; i <= n; i++){ str[i] = s[(r * 6807 % 201701 + 2831) % 201701 % 4]; r = (r * 6807 % 201701 + 2831) % 201701; } string s1; map<string, int>mp; int ans = 0, cnt = 1; while(cnt <= k) s1 = str[cnt++] + s1; mp[s1] = 1, ans++; for (int i = k + 1; i <= n; i++){ s1.pop_back(); s1 = str[i] + s1; if(!mp[s1]) ans++, mp[s1] = 1; } printf("%d\n", ans); return 0; }