21332_PerfectP-thPowers

2022-5-16 18:19| 发布者: Hocassian| 查看: 43| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505161498000-Problem List-采集的数据-后羿采集器.html

Pro.ID

21332

Title

Perfect P-th Powers

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21332

AC

11

Submit

62

Ratio

17.74%

时间&空间限制

  • Time Limit: 200/100 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    We say that x is a perfect square if, for some integer b, x = b2. Similarly, x is a perfect cube if, for some integer b, x = b3. More generally, x is a perfect p-th power if, for some integer b, x = b p. Given an integer x you are to determine the largest p such that x is a perfect p-th power.

    输入

    Each test case is given by a line of input containing x. The value of x will have magnitude at least 2 and be within the range of a (32-bit) int in C, C++, and Java. A line containing 0 follows the last test case.

    输出

    Description

    We say that x is a perfect square if, for some integer b, x = b2. Similarly, x is a perfect cube if, for some integer b, x = b3. More generally, x is a perfect p-th power if, for some integer b, x = b p. Given an integer x you are to determine the largest p such that x is a perfect p-th power.

    Input

    Each test case is given by a line of input containing x. The value of x will have magnitude at least 2 and be within the range of a (32-bit) int in C, C++, and Java. A line containing 0 follows the last test case.

    Output

    For each test case, output a line giving the largest integer p such that x is a perfect p-th power.

    Sample Input

    17
    1073741824
    25
    0

    Sample Output

    1
    30
    2

    Source

    样例输入

    17
    1073741824
    25
    0

    样例输出

    1
    30
    2

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部