#include <fstream>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <set>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int n,m,t;
set<int>sto;
set<int>::iterator it;
struct ans{
int x;
int y;
friend bool operator<(const ans &a,const ans &b)
{
if(a.y != b.y)
return a.y > b.y ;
else
return a.x > b.x;
}
};
priority_queue<ans> po;
ans *pt;
int tim,mau,cnt=0;
int main(){
ofstream fout ("ariprog.out");
ifstream fin ("ariprog.in");
fin>>n>>m;
for(int i=0;i<=m;i++){
for(int j=0;j<=m;j++){
t=i*i+j*j;
sto.insert(t);
}
}
mau=m*m*2;
for(it=sto.begin();it!=sto.end();it++){
tim=*it;
for(int i=1;i<=mau;i++){
cnt=0;
while(cnt<n){
cnt++;
if(sto.find(tim+cnt*i)==sto.end() ){
break;
}
}
if(cnt==n){
pt=new ans;
pt->x=tim;
pt->y=i;
po.push(*pt);
}
}
}
if(po.empty())
fout<<"NONE"<<endl;
while(!po.empty()){
fout<<po.top().x<<" "<<po.top().y<<endl;
po.pop();
}
}
ariprog
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.