QOJ.ac

QOJ

时间限制: 2 s 内存限制: 512 MB 总分: 100

#11118. 阻止银河战争!

统计

很久很久以前,在一个遥远的银河系……

贸易联盟是一个极其强大的组织,旗下联合了许多星系和星系团。在联盟的控制下,有 $N$ 个工业分支,每个分支生产一种独特的产品。

去年,第 $i$ 个分支生产了 $x_i$ 吨产品。其中一部分产品被送往其他分支进行生产,另一部分则出售给零售商。已知去年第 $j$ 个分支使用了 $c_{ij}$ 吨由第 $i$ 个分支生产的产品。此外,第 $i$ 个分支向零售商出售了 $y_i$ 吨产品。贸易联盟非常谨慎地控制着生产过程,因此没有任何产品的短缺或过剩。

反抗军的情报显示,联盟计划今年从第 $i$ 个分支出售 $\check{y}_i$ 吨产品。由于出售产品获得的利润可以帮助联盟建立机器人军队,反抗军希望破坏其生产。

你是年轻的绝地武士欧比旺·克诺比,你刚刚接到指令,计算每个分支今年应该生产多少产品(包括送往其他分支的产品)。已知第 $i$ 个分支所需的其他分支的产品量与第 $i$ 个分支的总产量成正比。请编写一个程序,在给定 $c_{ij}$、去年的销量 $y_i$ 和计划销量 $\check{y}_i$ 的情况下,计算第 $i$ 个分支今年应该生产多少吨产品 $\check{x}_i$。

愿原力与你同在!

输入格式

第一行包含一个整数 $N$,表示分支的数量 ($1 \le N \le 3000$)。

接下来的 $N$ 行,每行包含 $N$ 个整数,其中第 $i$ 行包含整数 $c_{i1}, c_{i2}, \dots, c_{iN}$ ($1 \le c_{ij} \le 1000$);$c_{ij}$ 表示去年第 $j$ 个分支使用了多少吨由第 $i$ 个分支生产的产品。

下一行包含 $N$ 个整数 $y_1, y_2, \dots, y_N$,表示去年每个分支出售给零售商的产品量 ($10^7 \le y_i \le 10^9$)。

最后一行包含 $N$ 个整数 $\check{y}_1, \check{y}_2, \dots, \check{y}_N$,表示今年计划出售给零售商的产品量 ($10^7 \le \check{y}_i \le 10^9$)。

输出格式

输出 $N$ 个数 $\check{x}_1, \check{x}_2, \dots, \check{x}_N$:每个分支今年应该生产的产品量。

如果 $\sqrt{\sum_{i=1}^n (\bar{y}_i - \check{y}_i)^2} < 10^{-4}$,则答案被认为是正确的,其中 $\bar{y}_i$ 是如果每个分支 $i$ 生产 $\check{x}_i$ 吨产品时,第 $i$ 个分支实际能出售的产品量。

样例

输入 1

3
1 10 1
11 1 1
1 12 1
10000000 20000000 20000000
30000000 20000000 30000000

输出 1

30000014.50000887 20000035.49997725 30000016.50001112

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.