結果
問題 | No.1738 What's in the box? |
ユーザー |
|
提出日時 | 2021-11-13 19:07:38 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 427 bytes |
コンパイル時間 | 2,946 ms |
コンパイル使用メモリ | 248,692 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-27 18:46:16 |
合計ジャッジ時間 | 4,443 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 70 |
ソースコード
#include <bits/stdc++.h>#define rep(i, n) for (int i = 0; i < (n); ++i)using std::cin;using std::cout;using std::vector;using ll = long long;int main() {int n, m;cin >> n >> m;vector<ll> w(n);rep(i, n) cin >> w[i];ll s = 0;rep(i, n) s += w[i];if (s == 0) {rep(i, n) cout << 0 << ' ';return 0;}vector<int> a(n);rep(i, n) a[i] = w[i] * m / s;rep(i, n) cout << a[i] << ' ';return 0;}