[USACO][Section 1.4][搜索] Arithmetic Progressions

题目大意:

给出两个整数n、m。要求找出一个n位等差数列,其元素属于集合{ p*p+q*q | 0<=p,q<=m }。

思路:

简单暴搜,具体思路见代码。

代码:

/*
ID: lujunda1
LANG: C++
PROG: ariprog
*/
#include
#include
using namespace std;
bool s[125001];//250*250*2
int n,m;
bool check(int start,int dif)
//判断是否存在从start开始,差为dif的n位等差数列。 
{
    for(int i=0;i	

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注