시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 (추가 시간 없음) | 512 MB | 70 | 47 | 42 | 66.667% |
Carryless addition is the same as normal addition, except any carries are ignored (in base 10). Thus, 37 + 48 is 75, not 85.
Carryless multiplication is performed using the schoolbook algorithm for multiplication, column by column, but the intermediate sums are calculated using carryless addition. Thus:
9 ∙ 1234 = 9000 + (900 + 900) + (90 + 90 + 90) + (9 + 9 + 9 + 9) = 9000 + 800 + 70 + 6 = 9876
90 ∙ 1234 = 98760
99 ∙ 1234 = 98760 + 9876 = 97536
Formally, define ck to be the kth digit of the value c. If c = a · b then
\[c_k = \left[ \sum_{i+j=k}{a_i \cdot b_j} \right] \mod 10\]
Given an integer n, calculate the smallest positive integer a such that a ∙ a = n in carryless multiplication.
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.
6
4
149
17
123476544
11112
15
-1
ICPC > Regionals > North America > Southeast USA Regional > 2019 Southeast USA Regional Programming Contest > Division 1 A번
ICPC > Regionals > North America > Southeast USA Regional > 2019 Southeast USA Regional Programming Contest > Division 2 B번
ICPC > Regionals > North America > Pacific Northwest Regional > 2019 ICPC Pacific Northwest Region > Division 1 L번
ICPC > Regionals > North America > Pacific Northwest Regional > 2019 ICPC Pacific Northwest Region > Division 2 Y번