Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
45509 | sunhuifeng | 寻宝石 | C++ | Accepted | 0 MS | 244 KB | 244 | 2024-04-14 20:03:58 |
#include<bits/stdc++.h> using namespace std; int a[101]; int main(){ int n; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } int s=a[0]+a[1]+a[2]; for(int i=1;i<n-2;i++){ s=max(s,a[i]+a[i+1]+a[i+2]); } cout<<s; return 0; }