什么是前缀和
前缀和的逆
它是前缀和的转变 a[i] = pre[i] - pre[i - 1]
Code:
#include <bits/stdc++.h> using namespace std; const int N = 105; int pre[N]; int main() { int N; cin >> N; for (int i = 1; i <= N; i++) { cin >> pre[i]; } for (int i = 1; i <= N; i++) { cout << pre[i] - pre[i - 1] << " \n"[i == N]; } return 0; }