結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<pair<int,ll>>>;
#define INF 1000000000
#define MOD 998244353
#define MAX 200000

int main(){
  int N;
  ll M;
  cin>>N>>M;
  vector<ll> W(N);
  ll sum=0;
  for(int i=0;i<N;i++){
    cin>>W[i];
    sum+=W[i];
  }
  if(M==0){
    for(int i=0;i<N;i++){
      cout<<0<<' ';
    }
    cout<<'\n';
    return 0;
  }
  for(int i=0;i<N;i++){
    cout<<W[i]*M/sum<<' ';
  }
  cout<<'\n';
}
0