| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 137990 | 陈家宝 | 最大子序和 | C++ | Accepted | 100 | 0 MS | 248 KB | 338 | 2024-03-13 13:14:26 |
#include<bits/stdc++.h> using namespace std; int a,b[110],f[110]; int dfs(int n){ if(f[n]!=-1)return f[n]; return f[n]=max(dfs(n-1)+b[n],b[n]); } int main() { memset(f,-1,sizeof(f)); cin>>a; for(int i=1;i<=a;i++)cin>>b[i]; dfs(a); int maxa=-999; for(int i=1;i<=a;i++)maxa=max(maxa,f[i]); cout<<maxa; return 0; }