#P8754. [蓝桥杯 2021 省 AB2] 完全平方数

    ID: 9672 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>2021数论素数判断,质数,筛法蓝桥杯省赛

[蓝桥杯 2021 省 AB2] 完全平方数

Problem Description

An integer aa is a perfect square number, meaning it is the square of some integer. That is, there exists an integer bb such that a=b2a=b^{2}.

Given a positive integer nn, find the smallest positive integer xx such that their product is a perfect square number.

Input Format

The input contains one line with a positive integer nn.

Output Format

Output the smallest positive integer xx found.

12
3
15
15 

Hint

For 30%30\% of the testdata, 1n10001 \leq n \leq 1000, and the answer does not exceed 10001000.

For 60%60\% of the testdata, 1n1081 \leq n \leq 10^{8}, and the answer does not exceed 10810^{8}.

For all testdata, 1n10121 \leq n \leq 10^{12}, and the answer does not exceed 101210^{12}.

Lanqiao Cup 2021, Second Round Provincial Contest, Group A Problem G (Group B Problem H).

Translated by ChatGPT 5