Carryless Square Root
题号:NC224869
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

输入描述:

The input consists of a single line with an integer n (1 ≤ n ≤ 1025).

输出描述:

Output the smallest positive integer that is a carryless square root of the input number, or −1 if no such number exists.
示例1

输入

复制
6

输出

复制
4
示例2

输入

复制
149

输出

复制
17
示例3

输入

复制
123476544

输出

复制
11112
示例4

输入

复制
15

输出

复制
-1