結果
問題 | No.1738 What's in the box? |
ユーザー | goteten |
提出日時 | 2021-11-12 21:43:51 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 540 bytes |
コンパイル時間 | 1,445 ms |
コンパイル使用メモリ | 168,328 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-25 17:43:29 |
合計ジャッジ時間 | 2,991 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 70 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() const long long INF = 1LL << 60; using ll = long long; using ld = long double; #define v2d(type,H,W,name,value) vector<vector<type>> name(H,vector<type>(W,value)); int main() { ll N,M; cin >> N >> M; vector<ll> a(N); rep(i,N){ cin >> a[i]; } ll sum=0; rep(i,N) sum+=a[i]; rep(i,N){ if(sum>0) cout << (a[i]*M)/sum; else cout << 0; if(i<N-1) cout << " "; } cout << endl; }