No.2954 Calculation of Exponentiation
Problem Statement
Is $A^B$ an integer?
Constraints
・ $0 < A \leq 100000$
・ $-100000 \leq B \leq 100000$
・ $A,B$ are rational numbers that can be represented in decimal notation with up to the $4$-th decimal place
・ $A,B$ are given in finite decimal notation, up to the $4$-th decimal place
Stricter Constraints
This section is for confirming the uniqueness of the input. We recommend skipping it.
The dot symbol . refers to the character . itself.
・A is given as a string matching the regular expression (0.[0-9]{4}|[1-9][0-9]{0,4}.[0-9]{4}|100000.0000), and is not 0.0000.
・B is given as a string matching the regular expression -?(0.[0-9]{4}|[1-9][0-9]{0,4}.[0-9]{4}|100000.0000), and is not -0.0000.
This also ensures that redundant representations such as -0.0000, +0.0000, 00.0000, and 01.0000 are not given.
Input
$A$ $B$
Output
If $A^B$ is an integer, print Yes. Otherwise, print No.
Sample
Sample 1
Input
9.0000 1.5000
Output
Yes
$9^{1.5} = 27$ is an integer. As shown here, the input is given up to $4$ digits after the decimal point.
Sample 2
Input
3.1415 -3.1415
Output
No
$3.1415^{-3.1415} = 0.0274\ldots$ is not an integer.
Sample 3
Input
100000.0000 100000.0000
Output
Yes
This is the maximum case.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
hamamu