题意: 求\(x^2 \equiv a \mod p\) 的所有整数解 思路: 二次剩余定理求解. 参考: 二次剩余Cipolla's algorithm学习笔记 板子: //二次剩余,p是奇质数 ll ppow(ll a, ll b, ll mod){ ll ret = 1; a = a % mod; while(b){ if(b & 1) ret = ret * a % mod; a = a * a % mod; b >>= 1; } return ret; } struct TT…
A. Plus and Square Root time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, ' + ' (plus) an…
The problem is so easy, that the authors were lazy to write a statement for it! Input The input stream contains a set of integer numbers Ai (0 ≤ Ai ≤ 1018). The numbers are separated by any number of spaces and line breaks. A size of the input stream…
A. Plus and Square Root 题目连接: http://codeforces.com/contest/715/problem/A Description ZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, ' + ' (plus) and '' (square root). Initially, the number 2 is d…
The problem is so easy, that the authors were lazy to write a statement for it! Input The input stream contains a set of integer numbers Ai (0 ≤ Ai ≤ 10^18). The numbers are separated by any number of spaces and line breaks. A size of the input strea…
Square root digital expansion It is well known that if the square root of a natural number is not an integer, then it is irrational. The decimal expansion of such square roots is infinite without any repeating pattern at all. The square root of two i…