CF30A.Accounting

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

A long time ago in some far country lived king Copa. After the recent king's reform, he got so large powers that started to keep the books by himself.

The total income A of his kingdom during 0-th year is known, as well as the total income B during n-th year (these numbers can be negative — it means that there was a loss in the correspondent year).

King wants to show financial stability. To do this, he needs to find common coefficient X — the coefficient of income growth during one year. This coefficient should satisfy the equation:

A·X__n = B.

Surely, the king is not going to do this job by himself, and demands you to find such number X.

It is necessary to point out that the fractional numbers are not used in kingdom's economy. That's why all input numbers as well as coefficient X must be integers. The number X may be zero or negative.

很久以前,在某个遥远的国度里住着一位国王——科帕。在最近一次国王改革之后,他获得了极大的权力,甚至开始亲自记账。

已知他的王国在第 00 年的总收入为 AA,在第 nn 年的总收入为 BB(这些数可以为负数——表示对应年份出现了亏损)。

国王希望展现财政稳定性。为此,他需要找出一个公共系数 XX——即每年收入的增长系数。该系数需满足如下方程:

A⋅Xn=B.A \cdot X^n = B.

当然,国王不会亲自完成这项工作,而是要求你找出满足条件的数 XX。

需要特别指出的是,该王国的经济中不使用小数。因此,所有输入数据以及系数 XX 都必须是整数。XX 可以为零或负数。

输入格式

The input contains three integers A, B, n (|A|, |B| ≤ 1000, 1 ≤ n ≤ 10).

输入包含三个整数 AA、BB、nn(∣A∣, ∣B∣≤1000|A|,\,|B|\leq 1000,1≤n≤101\leq n\leq 10)。

输出格式

Output the required integer coefficient X, or «No solution», if such a coefficient does not exist or it is fractional. If there are several possible solutions, output any of them.

输出所需的整数系数 X;如果不存在这样的系数,或该系数为分数,则输出 «No solution»。如果存在多个可能的解,输出其中任意一个即可。

输入输出样例

  • 输入#1

    2 18 2

    输出#1

    3
  • 输入#2

    -1 8 3

    输出#2

    -2
  • 输入#3

    0 0 10

    输出#3

    5
  • 输入#4

    1 16 5

    输出#4

    No solution

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

首页