結果

問題 No.1738 What's in the box?
ユーザー momoyuu
提出日時 2023-03-16 02:43:36
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 2,555 ms
コンパイル使用メモリ 246,068 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-18 09:07:52
合計ジャッジ時間 4,098 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 70
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll n,m;
    cin>>n>>m;
    if(m==0){
        for(int i = 0;i<n;i++){
            if(i!=0) cout<<" ";
            cout<<0;
        }
        return 0;
    }
    ll sum = 0;
    vector<ll> w(n);
    for(int i = 0;i<n;i++){
        cin >> w[i];
        sum += w[i];
    }
    for(int i = 0;i<n;i++){
        if(i!=0) cout<<" ";
        cout<<(w[i]*m)/sum;
    }
    return 0;
}

0