题目链接:1338: The minimum square sum

Description

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).

输入一个质数 p,你找出两个正整数 x 和 y 使得 (x2+y2) mod p = 0,且 x2+y2 最小。

Input

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

Output

The minimum square sum as described above.

Sample Input

2
3
5
7
11
13

Sample Output

2
18
5
98
242
13

分析

最新文章

  1. 精通Web Analytics 2.0 (5) 第三章:点击流分析的奇妙世界:指标
  2. MVC中使用Action全局过滤器出现:网页无法正常运作 将您重定向的次数过多。解决办法
  3. 有时候就是看不进论文-jQuery动画特效篇&amp;MySQL
  4. AES加密和Base64混合加密
  5. Pull Requests
  6. iOS-iPad开发之popoverController使用介绍
  7. mysql数据库优化[千万级查询]
  8. Asp.net mvc4 + HighCharts + 柱状图
  9. 前端--关于css选择器
  10. Apache commons (Java常用工具包)简介
  11. libpng处理png图片(一)
  12. POJ3083 Children of the Candy Corn(Bfs + Dfs)
  13. Architecture : Describable Command and Identifiable Data
  14. BlockingQueue(阻塞队列)详解
  15. 11-类中的__call__函数
  16. iOS -数据持久化方式-以真实项目讲解
  17. 几个js 拓扑图库
  18. 去除pt种里tracker的方法
  19. Photo Sphere Viewer 全景图
  20. Cordova 微信分享插件,安卓亲测可用

热门文章

  1. JS中注入eval, Function等系统函数截获动态代码
  2. Kali Linux硬盘扩容
  3. 查看mysql事务的隔离级别
  4. cv2.fillConvexPoly()与cv2.fillPoly()填充多边形
  5. ImageSwitcher 图片切换器
  6. WPF 问题 PresentationCore.dll!System.Windows.Media.Composition.DUCE.Channel.SyncFlush() 分析
  7. 我的一个PLSQL存储过程【我】 改版,加入日志表
  8. python链接mysql pymysql
  9. 【Java】分布式自增ID算法---雪花算法 (snowflake,Java版)
  10. 123457123456#0#-----com.tym.myNewShiZi45--前拼后广--识字tym