C++11_O2:10pts求助!!
查看原帖
C++11_O2:10pts求助!!
977778
__Harry_Haiyun__楼主2023/7/7 10:57
#1,#3,#4,#5,#6,#7,#8,#9 Wrong Answer
#2 Runtime Error
#10 Accepted
#include <bits/stdc++.h>
#define MOD 998244353
using namespace std;
const long long mod = 1000000007;
const int ll = 1005;
int main()
{
	int n,m;
	cin >> n >> m;
	int add[ll],plus = 0;
	int input[n];
	for (int i = 0; i < n; i++) cin >> input[i];
	for (int i = 0; i < n; i++)
	{
        for (int j = i; j <= i + 2; j++) plus += input[j];
	    add[i] = plus;
    }
    sort(add,add + ll);
    int s = 0;
    while (add[s] != 0) s++;
    cout << add[s] << endl;
	return 0;
}
2023/7/7 10:57
加载中...