简单的前缀和
灯能亮,用1表示,灯不亮,用0表示。 a[x] 表示第x盏灯能否亮, c 数组是 a数组的前缀和
然后暴力遍历,长度为 k 的灯的总和 s(k), 题目所求就是 min{k - s(k)}
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
const int MaxN = 100000 + 10;
int n, k, b
简单的前缀和
灯能亮,用1表示,灯不亮,用0表示。 a[x] 表示第x盏灯能否亮, c 数组是 a数组的前缀和
然后暴力遍历,长度为 k 的灯的总和 s(k), 题目所求就是 min{k - s(k)}
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
const int MaxN = 100000 + 10;
int n, k, b