問題一覧 > 通常問題

No.1738 What's in the box?

レベル : / AI推定難易度 : 140 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 186
作問者 : Shirotsume / テスター : nok0 とりゐ
お気に入りにしたユーザー ProblemId : 7152 / 自分の提出
問題文最終更新日: 2021-11-01 00:40:23
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 322 (順位表) の他の問題:

Problem Statement

There are $N$ boxes. The boxes are numbered $1, 2, 3, ... N $. Each box contains $0$ or more balls.

In addition, the following facts are known.

    • The weight of $1$ ball is a positive real number, and all balls have the same weight.
    • The total weight of the balls in box $i$ is $W_i$.
    • The total number of balls in the $N$ boxes is $M$.

From these conditions, find the number of balls in each box.

Constraints

  • All inputs are integers.
  • $1 \leq N \leq 1000$
  • $0 \leq M \leq 10^{9}$
  • $0 \leq W_i \leq 10^{9}$ ($1 \leq i \leq N$)
  • The input is given such that a combination of numbers of balls satisfying the conditions exists uniquely.

Input

The input is given from standard input in the following format.

$N$ $M$
$W_1$ $W_2$ $W_3$ $\dots$ $W_N$

・The $1$st line contains $N$ and $M$, separated by a space.

・The $2$nd line contains $W_i$ ($1 \leq i \leq N$), separated by spaces.

Output

$A_1$ $A_2$ $\dots$ $A_N$

Output the sequence $A$, which represents the combination of numbers of balls satisfying the given conditions, separated by spaces.

Here, $A_i$ is the number of balls in the $i$-th box.

Print a newline at the end.

Sample

Sample 1
Input
3 30
1 2 3
Output
5 10 15

If the weight of $1$ ball is $0.2$ and the boxes contain $5$, $10$, and $15$ balls in order starting from box $1$, all the given conditions are satisfied.

Note that the weight of $1$ ball is not necessarily an integer.

Sample 2
Input
3 100
100 0 0
Output
100 0 0

Box $1$ contains $100$ balls of weight $1$. Note that some boxes may contain no balls.

Sample 3
Input
5 3267948
399576 2653028 2603840 54518 824934
Output
199788 1326514 1301920 27259 412467

The weight of $1$ ball is $2$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。