2299: The minimum square sum

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:73 解决:34

题目描述

Given a prime p (p<108),you are to find min{x2+y2},where x and y belongs to positive integer, 

so that x2+y2=0 (mod p). 

输入

  Every line is a p. No more than 10001 test cases.

输出

The minimum square sum as described above.

样例输入 复制

2
3
5

样例输出 复制

2
18
5

来源/分类