Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
33602 23级逯一鸣 【S】T3 C++ 通过 100 8 MS 548 KB 486 2024-10-16 12:25:12

Tests(10/10):


#include <algorithm> #include <cstdio> #include <vector> using namespace std; using i64 = long long; int main() { int n, mod; scanf("%d %d", &n, &mod); int total = 0; vector<int> cnt(mod, 0); for (int i = 1; i <= n; ++i) { int b; scanf("%d", &b); if (b == 1) { ++cnt[i % mod]; ++total; } } printf("%d\n", total - *max_element(cnt.begin(), cnt.end())); return 0; }


测评信息: