Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
37850 Venus 基因组分析 C++ 解答错误 0 1 MS 912 KB 779 2022-04-22 20:25:40

Tests(0/10):


#include <iostream> #include <algorithm> const int N = 1e5 + 7, M = 4e7; int n, k, r[N], a[N], vis[M], ans, mx, part; int read() { int ans = 0; bool neg = false; char c = getchar(); while (c!='-' && !isdigit(c)) c = getchar(); if (c == '-') neg = true, c = getchar(); while (isdigit(c)) ans = 10*ans + c-'0', c = getchar(); return neg ? -ans : ans; } int main(){ n = read(), k = read(), r[1] = read(); for(int i = 1; i <= n; ++i){ a[i] = r[i]%4; r[i+1] = (r[i]*6807+2831) % 201701; } for (int i = 1; i <= n-k+1; i++) { part = 0; for (int j = 1; j <= k; j++){ part += a[i+j]; part *= 4; } vis[part]++; mx = std::max(mx, part); } for (int i = 0; i <= mx; i++) if (vis[i]) ans++; printf("%d", ans); return 0; }


测评信息: