类似于打家劫舍,取不相邻的数,记得输出的时候,换成%lld #include <iostream> using namespace std; const int N = 100010; int a[N]; long long f[N]; int n; int main() { cin >> n; for (int i = 1; i <= n; i ++) { cin >> a[i]; } f[0] = 0, f[1] = a[1]; for (int i = 2; i <= n...