CF185B.Mushroom Scientists

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the distance between the center of the Universe and the point is calculated by the following formula: . Mushroom scientists that work for the Great Mushroom King think that the Universe isn't exactly right and the distance from the center of the Universe to a point equals x__a·y__b·z__c.

To test the metric of mushroom scientists, the usual scientists offered them a task: find such x, y, z (0 ≤ x, y, z; x + y + z ≤ S), that the distance between the center of the Universe and the point (x, y, z) is maximum possible in the metric of mushroom scientists. The mushroom scientists aren't good at maths, so they commissioned you to do the task.

Note that in this problem, it is considered that 00 = 1.

众所周知,整个宇宙传统上采用三维笛卡尔坐标系。在此坐标系中,每个点对应三个实数坐标 (x, y, z)(x,\,y,\,z)。在该坐标系中,宇宙中心到该点的距离由以下公式计算:
。

为宇宙蘑菇之王工作的蘑菇科学家认为,宇宙并非完全正确,他们定义宇宙中心到点 (x, y, z)(x,\,y,\,z) 的距离为 xa⋅yb⋅zcx^a \cdot y^b \cdot z^c。

为了检验蘑菇科学家所提出的度量,普通科学家向他们提出一个任务:在约束条件 0≤x, y, z0 \le x,\,y,\,z 且 x+y+z≤Sx + y + z \le S 下,找出使蘑菇科学家度量下宇宙中心到点 (x, y, z)(x,\,y,\,z) 的距离 xa⋅yb⋅zcx^a \cdot y^b \cdot z^c 达到最大值的 x, y, zx,\,y,\,z。蘑菇科学家不擅长数学,因此委托你来完成此项任务。

注意:本题中约定 00=10^0 = 1。

输入格式

The first line contains a single integer S (1 ≤ S ≤ 103) — the maximum sum of coordinates of the sought point.

The second line contains three space-separated integers a, b, c (0 ≤ a, b, c ≤ 103) — the numbers that describe the metric of mushroom scientists.

第一行包含一个整数 SS(1≤S≤1031 \leq S \leq 10^3)——所求点的坐标和的最大值。

第二行包含三个用空格分隔的整数 aa、bb、cc(0≤a,b,c≤1030 \leq a, b, c \leq 10^3)——描述蘑菇科学家所用度量的参数。

输出格式

Print three real numbers — the coordinates of the point that reaches maximum value in the metrics of mushroom scientists. If there are multiple answers, print any of them that meets the limitations.

A natural logarithm of distance from the center of the Universe to the given point in the metric of mushroom scientists shouldn't differ from the natural logarithm of the maximum distance by more than 10 - 6. We think that ln(0) =  - ∞.

输出三个实数——在蘑菇科学家度量下使目标函数取得最大值的点的坐标。若存在多个解,输出任意一个满足限制条件的解即可。

该点到宇宙中心的距离(在蘑菇科学家度量下)的自然对数与最大距离的自然对数之差的绝对值不应超过 10−610^{-6}。我们约定 ln⁡(0)=−∞\ln(0) = -\infty。

输入输出样例

  • 输入#1

    3
    1 1 1

    输出#1

    1.0 1.0 1.0
  • 输入#2

    3
    2 0 0

    输出#2

    3.0 0.0 0.0

输入解题思路,AI测评打分。不知道怎么写?

首页