1 条题解
-
0
C++ :
#include <iostream> #include <cstdio> #include <string> #include <algorithm> using namespace std; long long dp[110]; int main() { //freopen("in.txt", "r", stdin); int T, n; while (cin>>T) { while (T--) { cin>>n; dp[0] = 0; long long ans = 0; for (int i=1; i<=n; i++) { long long temp; cin>>temp; dp[i] = max(dp[i-1]+temp, temp); ans = max(ans, dp[i]); } cout<<ans<<endl; } } return 0; }
- 1
信息
- ID
- 701
- 时间
- 5000ms
- 内存
- 64MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者