結果

問題 No.1738 What's in the box?
ユーザー ktr216
提出日時 2021-11-12 22:02:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 1,501 ms
コンパイル使用メモリ 170,032 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-25 18:33:17
合計ジャッジ時間 3,003 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 70
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, l, r) for (int i = (l); i < (r); i++)
using namespace std;

typedef long long ll;

int main() {
    ll N, M, S = 0;
    cin >> N >> M;
    vector<ll> W(N);
    rep(i, 0, N) {
        cin >> W[i];
        S += W[i];
    }
    rep(i, 0, N) {
        if (S == 0) cout << 0;
        else cout << M * W[i] / S;
        if (i == N - 1) cout << endl;
        else cout << " ";
    }
}
0