Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
33610 | LYLAKIOIAKIOI | 【S】T3 | C++ | 通过 | 100 | 12 MS | 616 KB | 521 | 2024-10-16 12:56:11 |
#include<bits/stdc++.h> #define ull unsigned long long #define PII pair<int,int> #define mk make_pair #define fi first #define se second using namespace std; const int N=1e6+10; const int INF=1e9+10; int n,d;int a[N]; int main(){ cin>>n>>d;for(int i=1;i<=n;i++) cin>>a[i]; int ca=0;for(int i=1;i<=n;i++) ca+=a[i]; int tmp=0; for(int i=1;i<=d;i++){ int now=0; for(int j=i;j<=n;j+=d){ now+=a[j]; }tmp=max(tmp,now); }cout<<ca-tmp; return 0; }