注意点在于set要重载所有元素
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL>pii;
const int N=2e3+50;
vector<pii>G[N];
LL dis[N];
struct node{
LL a,b,c;
bool operator < (const node &t)const{
if(t.a==a)
{
if(t.b==b)
{
return t.c<c;
}
return t.b<b;
}
return t.a<a;
}
};
LL gcd(LL a,LL b)
{
return b?gcd(b,a%b):a;
}
set<node>st;
void solve()
{
int idx=0;
for(int i=0;i<20;i++)
{
for(int j=0;j<21;j++)
{
for(int x=0;x<20;x++)
{
for(int y=0;y<21;y++)
{
if(i!=x&&j!=y)
{
int a=j-y,b=x-i,c=i*y-x*j;
int t=gcd(gcd(a,b),c);
st.insert({a/t,b/t,c/t});
//cout<<st.size()<<endl;
//cout<<i<<" "<<j<<" "<<x<<" "<<y<<" "<<a/t<<" "<<b/t<<" "<<c/t<<endl;
}
}
}
}
}
printf("%d",st.size()+41);
}
int main()
{
int t=1;
//scanf("%d",&t);
while(t--)
{
solve();
}
}