#include <cstdio> #include <cstring> #define max(a,b) ((a)>(b)?(a):(b)) int a[1010], dp[1010]; int main() { int n; while (scanf("%d", &n) != EOF) { memset(dp, 0, sizeof(dp)); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); dp[i] = ...