Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
45630 | 承诺 | 寻宝石 | C++ | Accepted | 1 MS | 248 KB | 241 | 2024-04-19 15:46:19 |
#include<bits/stdc++.h> using namespace std; int main(){ int a[100009],n,lei=0; cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=n-2;i++){ if(lei<a[i]+a[i+1]+a[i+2]) lei=a[i]+a[i+1]+a[i+2]; } cout<<lei; return 0; }