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

Tests(2/10):


#include <iostream> #include <algorithm> const int N = 1e5 + 7, M = 2e7; int n, k, r[N], a[N], vis[M], ans, mx; 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++) { int 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 = 1; i <= mx; i++) if (vis[i]) ans++; printf("%d", ans); return 0; }


测评信息: