# bzoj3275 Number

## 3275: Number

Time Limit: 10 Sec  Memory Limit: 128 MB
Submit: 558  Solved: 246
[Submit][Status][Discuss]

## Description

1:存在正整数C，使a*a+b*b=c*c
2:gcd(a,b)=1

an。

5
3 4 5 6 7

22

n<=3000。

## Source

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#define F(i,j,n) for(int i=j;i<=n;i++)
#define D(i,j,n) for(int i=j;i>=n;i--)
#define ll long long
#define pa pair<int,int>
#define maxn 3100
#define maxm 10000000
#define inf 1000000000
using namespace std;
struct edge_type
{
int next,to,v;
}e[maxm];
int n,s,t,ans=0,tot=0,cnt=1;
{
int x=0,f=1;char ch=getchar();
while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
inline void add_edge(int x,int y,int v)
{
}
inline bool bfs()
{
queue<int>q;
memset(dis,-1,sizeof(dis));
dis[s]=0;q.push(s);
while (!q.empty())
{
int tmp=q.front();q.pop();
if (tmp==t) return true;
{
dis[e[i].to]=dis[tmp]+1;
q.push(e[i].to);
}
}
return false;
}
inline int dfs(int x,int f)
{
if (x==t) return f;
int tmp,sum=0;
for(int &i=cur[x];i;i=e[i].next)
{
int y=e[i].to;
if (e[i].v&&dis[y]==dis[x]+1)
{
tmp=dfs(y,min(f-sum,e[i].v));
e[i].v-=tmp;e[i^1].v+=tmp;sum+=tmp;
if (sum==f) return sum;
}
}
if (!sum) dis[x]=-1;
return sum;
}
inline void dinic()
{
while (bfs())
{
ans+=dfs(s,inf);
}
}
inline bool check(int x,int y)
{
int tmp=x*x+y*y,rt=int(sqrt(tmp));
if (rt*rt!=tmp) return false;
if (x<y) swap(x,y);
while (y) {tmp=x%y;x=y;y=tmp;}
return (x==1);
}
int main()
{
s=n+1;t=n+2;
F(i,1,n)
{