c++ - 给定整数 n 决定是否可以将其表示为两个整数的平方和

标签 c++ c

<分区>

输入规范:

First line of input contains one integer t <= 10000: number of test cases. T lines follow, each of them consisting of exactly one integer 0 <= n <= 10^8.

输出规范:

For each test case output Yes if it is possible to represent given number as a sum of two squares and No if it is not possible.

最佳答案

提示:数字 N 可以表示为 2 个平方和 iff 在 N 的素因式分解中,形式为 (4k+3) 的每个素数出现一个偶数次!

关于c++ - 给定整数 n 决定是否可以将其表示为两个整数的平方和,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5055527/

相关文章:

c# - 性能瓶颈 - 使用 Visual Studio

c++ - 从长远来看,最好的方法是什么 : C, Objective C 或 C++?

c - 在sendmsg和recvmsg(unix套接字)中定义msghdr长度

c++ - 是否可以在 C++ 中对 C 结构进行子类化并在 C 代码中使用指向该结构的指针?

c - NDIS lwf(协议(protocol))驱动程序是否需要在Windows中签署数字签名使用?

c++ - 如何在 C++ 中访问新主函数的参数?

c++ - 如何在外语和返回共享指针的 C++ 库之间进行接口(interface)

c++ - CreatePolygonRgn 和 const POINT *

c++ - 如何访问子类函数

c - 有没有办法确定是否有任何线程正在等待给定的条件变量?