結果

問題 No.970 数列変換マシン
ユーザー fine
提出日時 2020-01-17 21:24:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 449 bytes
コンパイル時間 1,564 ms
コンパイル使用メモリ 167,492 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 18:28:55
合計ジャッジ時間 2,722 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n);
    ll sum = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum += a[i] * (n - 1);
    }
    sum /= (n - 1);

    for (int i = 0; i < n; ++i) {
        a[i] = sum - a[i] * (n - 1);
        cout << a[i] << " \n"[i + 1 == n];
    }
    return 0;
}
0