Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
20004 | 桑迪 | 关灯 | C++ | Wrong Answer | 0 | 0 MS | 248 KB | 314 | 2021-05-27 21:36:22 |
#include<iostream> using namespace std; int main() { int i,n,ans,dp[100],a[100]; cin>>n; for(i=1;i<=n;i++) cin>>a[i]; dp[1]=a[1]; ans=a[1]; for(i=2;i<=n;++i){ if(a[i]<=dp[i-1]+a[i]) dp[i]=dp[i-1]+a[i]; else dp[i]=a[i]; if(ans<dp[i]) ans=dp[i]; } cout<<ans; return 0; }