問題一覧 > 通常問題

No.2954 Calculation of Exponentiation

レベル : / AI推定難易度 : 1350 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 61
作問者 : 👑 binap / テスター : 👑 p-adic 👑 hamamu
お気に入りにしたユーザー ProblemId : 10943 / 自分の提出
問題文最終更新日: 2025-01-07 22:38:39
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 452 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。