답안 #925968

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
925968 2024-02-12T12:04:21 Z Karoot 평균 (COCI14_prosjek) C++17
50 / 50
1 ms 500 KB
#include <iostream>
#include <cmath>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <string>
#include <iomanip>
#include <algorithm>

#define all(x)  (x).begin(), (x).end()
#define rall(x)  (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;

ll linf = 1e15+1;

inline void scoobydoobydoo(){
    ios::sync_with_stdio(false);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
}


int main(){
    scoobydoobydoo();
    int n; cin >> n;
    vector<ll> ans(n), vals(n);
    for (int i = 0; i < n; i++){
        cin >> vals[i];
        vals[i] *= (i+1);
    }

    ans[0] = vals[0];
    ll sum = ans[0];

    for (int i = 1; i < n; i++){
        ans[i] = vals[i]-sum;
        sum += ans[i];
    }

    for (int i = 0; i < n; i++)cout << ans[i] << " ";
    cout << endl;
    
    return 0;
} 
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 500 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 460 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct