알고리즘

[알고리즘] 백준 10539 - 수빈이와 수열 (C++)

blueberrysoda 2024. 10. 26. 23:57

[문제 링크] : https://www.acmicpc.net/problem/10539

#include <iostream>
using namespace std;

int main(){
    int N;
    cin >> N;

    int sum = 0, M, res;

    for(int i=0; i<N; i++){
        cin >> M;
        res = M * (i + 1) - sum;
        cout << res << " ";
        sum += res;
    }
    cout << "\n";
    return 0;
}