标签:problem ack turn main ret size using max i++
///@ref geeksforgeeks ///@author Sycamore ///@date 9/11/2017 ///@link http://acm.hdu.edu.cn/showproblem.php?pid=2713 #include<bits/stdc++.h> using namespace std; int m[150001][2]; int main() { ios::sync_with_stdio(false); cin.tie(0); int P,s; while (cin >> P) { m[0][0] = m[0][1] = 0; for (int i = 1; i <= P; i++) { cin >> s; m[i][0] = max(m[i-1][0], m[i - 1][1] + s); m[i][1] = max(m[i-1][1], m[i - 1][0] - s); } cout << max(m[P][0], m[P][1])<<‘\n‘; } return 0; }
标签:problem ack turn main ret size using max i++
原文地址:http://www.cnblogs.com/zjnu/p/7507145.html