#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define int long long #define double long double #define rep(i,l,r) for(int i=l;i<=r;i++) #define rep2(i,l,r) for(int i=l;i<r;i++) #define pii pair<int,int> #define x first #define y second #define eps (1e-9) #define INF 1e10 #define N 2001 #define ll long long #define ld long double #define int long long usingnamespace std; int n;
signedmain(){ cin>>n; vector<int> vec(n); rep2(i,0,n){ string s;cin>>s; int num = 0,times = 1000000000; for(int i=2;i<=10;i++){ num += (s[i]-'0')*times; times/=10; } vec[i] = num; } unordered_multimap<int,int> mp; for(int i=0;i<n;i++){ mp.insert({vec[i],i}); } int ans = 0; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ ans += mp.count(vec[i] + vec[j]); } } cout<<ans<<endl; }
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a,i<=b;i++) #define rep2(i,a,b) for(int i=a;i<b;i++) #define pii pair<int,int> #define pdd pair<double,double> #define int long long #define ll long long #define ld long double #define N 1003 #define eps 1e-9 #define x first #define y second usingnamespace std; int n; pii p[N];
intdist(pii a,pii b){ int x = a.x-b.x,y = a.y-b.y; return x*x+y*y; }
signedmain(){ Orz; cin>>n; rep2(i,0,n)cin>>p[i].x>>p[i].y; map<int,int>mp; for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ int dis = dist(p[i],p[j]); mp[dis]+=1; } } int ans = 0; for(auto i:mp){ int cnt = i.second; ans+=((cnt*(cnt-1))/2); } cout<<ans<<endl; }
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a;i<=b;i++) #define pii pair<int,int> #define pdd pair<double,double> #define int long long #define ll long long #define ld long double #define N 1003 #define eps 1e-9 #define x first #define y second
usingnamespace std;
structpt{ int x,y; booloperator < (pt b){ if(x == b.x)return y < b.y; return x < b.x; } booloperator > (pt b){ if(x == b.x)return y > b.y; return x > b.x; } booloperator == (pt b){ if(x-b.x<=eps && y-b.y<=eps)returntrue; returnfalse; } pt operator+(pt b) {return {x + b.x, y + b.y};} //向量相加 pt operator-(pt b) {return {x - b.x, y - b.y};} //向量相減 intoperator^(pt b) {return x * b.y - y * b.x;} //向量外積cross intoperator*(pt b) {return x * b.x + y * b.y;} //向量內積dot }; vector<pt> a; intdir(pt a, pt b, pt o){ int cross = (a - o) ^ (b - o); if(fabs(cross) <= eps) return0; elseif(cross > 0) return1; elsereturn-1; }
int n,t;
signedmain(){ Orz; cin>>n; a.resize(n+2); rep(i,1,n)cin>>a[i].x>>a[i].y; int right = 0,left = 0,turn = 0; pt pre = a[1],from = a[2]; for(int i=3;i<=n;i++){ int ori = dir(a[i],from,pre); if(ori == 1)right+=1; elseif(ori == -1)left+=1; elseif(ori == 0 && ((a[i]-from)*(from-pre))<0)turn+=1; pre = from;from = a[i]; } cout<<left<<" "<<right<<" "<<turn<<endl; }
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a;i<=b;i++) #define pii pair<int,int> #define pdd pair<double,double> #define int long long #define ll long long #define ld long double #define N 1003 #define eps 1e-9 #define x first #define y second
usingnamespace std;
structpt{ int x,y; booloperator < (pt b){ if(x == b.x)return y < b.y; return x < b.x; } booloperator > (pt b){ if(x == b.x)return y > b.y; return x > b.x; } booloperator == (pt b){ if(x-b.x<=eps && y-b.y<=eps)returntrue; returnfalse; } pt operator+(pt b) {return {x + b.x, y + b.y};} //向量相加 pt operator-(pt b) {return {x - b.x, y - b.y};} //向量相減 intoperator^(pt b) {return x * b.y - y * b.x;} //向量外積cross intoperator*(pt b) {return x * b.x + y * b.y;} //向量內積dot }; vector<pt> point; intdir(pt a, pt b, pt o){ //方向函數 int cross = (a - o) ^ (b - o); if(fabs(cross) <= eps) return0; elseif(cross > 0) return1; elsereturn-1; } boolonseg(pt a, pt b, pt o){ //o是否在ab線段上 int cross = (a - o) ^ (b - o); //是否平行 int dot = (a - o) * (b - o); //是否在線段中 return (cross == 0)&&(dot <= 0); }
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a;i<=b;i++) #define pii pair<int,int> #define pdd pair<double,double> #define int long long #define ll long long #define ld long double #define N 100001 #define eps 1e-9 #define x first #define y second
usingnamespace std;
structpt{ int x,y; booloperator < (pt b){ if(x == b.x)return y < b.y; return x < b.x; } booloperator > (pt b){ if(x == b.x)return y > b.y; return x > b.x; } booloperator == (pt b){ if(x-b.x<=eps && y-b.y<=eps)returntrue; returnfalse; } pt operator+(pt b) {return {x + b.x, y + b.y};} //向量相加 pt operator-(pt b) {return {x - b.x, y - b.y};} //向量相減 intoperator^(pt b) {return x * b.y - y * b.x;} //向量外積cross intoperator*(pt b) {return x * b.x + y * b.y;} //向量內積dot }; boolcmp(pt a, pt b){ if(a.x == b.x)return a.y < b.y; return a.x < b.x; } vector<pt> p;
boolcheck(pt a,pt b,pt o){ int cross = (a - o)^(b - o); return cross >= 0; //這裡很關鍵,別吃WA }
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a;i<=b;i++) #define pii pair<int,int> #define pdd pair<double,double> #define int long long #define ll long long #define ld long double #define N 100001 #define eps 1e-9 #define x first #define y second
usingnamespace std;
structpt{ int x,y; booloperator < (pt b){ if(x == b.x)return y < b.y; return x < b.x; } booloperator > (pt b){ if(x == b.x)return y > b.y; return x > b.x; } booloperator == (pt b){ if(x-b.x<=eps && y-b.y<=eps)returntrue; returnfalse; } pt operator+(pt b) {return {x + b.x, y + b.y};} //向量相加 pt operator-(pt b) {return {x - b.x, y - b.y};} //向量相減 intoperator^(pt b) {return x * b.y - y * b.x;} //向量外積cross intoperator*(pt b) {return x * b.x + y * b.y;} //向量內積dot }; boolcmp(pt a, pt b){ if(a.x == b.x)return a.y < b.y; return a.x < b.x; }
vector<pt> p;
boolcheck(pt a,pt b,pt o){ int cross = (a - o)^(b - o); return cross >= 0; }
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a;i<=b;i++) #define pii pair<int,int> #define pdd pair<double,double> #define int long long #define ll long long #define ld long double #define N 100001 #define all(x) x.begin(),x.end() #define eps 1e-9 #define x first #define y second
usingnamespace std;
structpt{ int x,y; booloperator < (pt b){ if(x == b.x)return y < b.y; return x < b.x; } booloperator > (pt b){ if(x == b.x)return y > b.y; return x > b.x; } booloperator == (pt b){ if(x-b.x == 0 && y-b.y == 0)returntrue; returnfalse; } pt operator+(pt b) {return {x + b.x, y + b.y};} //向量相加 pt operator-(pt b) {return {x - b.x, y - b.y};} //向量相減 intoperator^(pt b) {return x * b.y - y * b.x;} //向量外積cross intoperator*(pt b) {return x * b.x + y * b.y;} //向量內積dot };
vector<pt> p; vector<int> cnt; int n,ans = 0;
boolcmp(pt a, pt b){ bool f1 = a < pt{0,0}; bool f2 = b < pt{0,0}; if(f1 != f2)return f1 < f2; return (a ^ b) > 0; //逆時針將點進行極角排序,從270度開始逆時針 }
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a;i<=b;i++) #define pii pair<int,int> #define pdd pair<double,double> #define int long long #define ll long long #define ld long double #define N 100001 #define all(x) x.begin(),x.end() #define eps 1e-9 #define x first #define y second
usingnamespace std;
structpt{ int x,y; booloperator < (pt b){ if(x == b.x)return y < b.y; return x < b.x; } booloperator > (pt b){ if(x == b.x)return y > b.y; return x > b.x; } booloperator == (pt b){ if(x-b.x == 0 && y-b.y == 0)returntrue; returnfalse; } pt operator+(pt b) {return {x + b.x, y + b.y};} //向量相加 pt operator-(pt b) {return {x - b.x, y - b.y};} //向量相減 intoperator^(pt b) {return x * b.y - y * b.x;} //向量外積cross intoperator*(pt b) {return x * b.x + y * b.y;} //向量內積dot };
vector<pt> p; vector<int> cnt; int n,edge,ans;
intsolve(){ int area = 0; rep(i,0,n-1){ area += (p[i]^p[i+1]); if(p[i].y == p[i+1].y)edge += abs(p[i].x-p[i+1].x); if(p[i].x == p[i+1].x)edge += abs(p[i].y-p[i+1].y); } area = abs(area); return area; }
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a;i<=b;i++) #define pii pair<int,int> #define pdd pair<double,double> #define int long long #define ll long long #define ld long double #define N 100001 #define all(x) x.begin(),x.end() #define eps 1e-9 #define x first #define y second
usingnamespace std;
structpt{ int x,y; booloperator < (pt b){ if(x == b.x)return y < b.y; return x < b.x; } booloperator > (pt b){ if(x == b.x)return y > b.y; return x > b.x; } booloperator == (pt b){ if(x-b.x == 0 && y-b.y == 0)returntrue; returnfalse; } pt operator+(pt b) {return {x + b.x, y + b.y};} //向量相加 pt operator-(pt b) {return {x - b.x, y - b.y};} //向量相減 intoperator^(pt b) {return x * b.y - y * b.x;} //向量外積cross intoperator*(pt b) {return x * b.x + y * b.y;} //向量內積dot };
vector<pt> p,temp,pp; vector<int> cnt; int n,ans = 0;
boolcmp(pt a, pt b){ bool f1 = a < pt{0,0}; bool f2 = b < pt{0,0}; if(f1 != f2)return f1 < f2; return (a ^ b) > 0; //逆時針將點進行極角排序,從270度開始逆時針 }
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a;i<=b;i++) #define pii pair<int,int> #define pdd pair<double,double> #define int long long #define ll long long #define ld long double #define N 100001 #define all(x) x.begin(),x.end() #define eps 1e-9 #define x first #define y second
usingnamespace std;
structpt{ int x,y,ind; booloperator < (pt b){ if(x == b.x)return y < b.y; return x < b.x; } booloperator > (pt b){ if(x == b.x)return y > b.y; return x > b.x; } booloperator == (pt b){ if(x-b.x == 0 && y-b.y == 0)returntrue; returnfalse; } pt operator+(pt b) {return {x + b.x, y + b.y};} //向量相加 pt operator-(pt b) {return {x - b.x, y - b.y};} //向量相減 intoperator^(pt b) {return x * b.y - y * b.x;} //向量外積cross intoperator*(pt b) {return x * b.x + y * b.y;} //向量內積dot intdis(){return x*x + y*y;} };
vector<pt> p,hull; pt pt_ans; int n,h;
boolcheck(pt a, pt b, pt o){ pt aa = a - o; pt bb = b - o; return (aa ^ bb) >= 0; }
boolcheck2(pt a,pt b,pt c,pt d){ int aa = abs((a - c)^(b - c)); int bb = abs((a - d)^(b - d)); return aa < bb; }
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a;i<=b;i++) #define pii pair<int,int> #define pdd pair<double,double> #define int long long #define ll long long #define ld long double #define N 100001 #define eps 1e-9 #define x first #define y second
usingnamespace std;
structpt{ ld x,y; booloperator < (pt b){ if(x == b.x)return y < b.y; return x < b.x; } booloperator > (pt b){ if(x == b.x)return y > b.y; return x > b.x; } booloperator == (pt b){ if(abs(x-b.x)<=eps && abs(y-b.y)<=eps)returntrue; returnfalse; } pt operator+(pt b) {return {x + b.x, y + b.y};} //向量相加 pt operator-(pt b) {return {x - b.x, y - b.y};} //向量相減 ld operator^(pt b) {return x * b.y - y * b.x;} //向量外積cross ld operator*(pt b) {return x * b.x + y * b.y;} //向量內積dot }; boolcmp(pt a, pt b){ if(a.x == b.x)return a.y < b.y; return a.x < b.x; } vector<pt> p,hull; int n,t,h; ld ans;
boolcheck(pt a,pt b,pt o){ int cross = (a - o)^(b - o); return cross >= 0; //這裡很關鍵,別吃WA }
boolcheck2(pt a,pt b,pt c,pt d){ ld aa = (a - c)^(b - c); ld bb = (a - d)^(b - d); return aa < bb; }
voidsolve(){ int d,sz = hull.size(); rep(i,0,sz-1){ rep(j,i+1,sz-1){ d = (j+1)%sz; while(check2(hull[i],hull[(j)%sz],hull[d],hull[(d+1)%sz])) d = (d+1)%sz; ans = max(ans,area((hull[d]-hull[i]),(hull[d]-hull[j]))); } } }
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a;i<=b;i++) #define pii pair<int,int> #define pdd pair<double,double> #define int long long #define ll long long #define ld long double #define N 50005 #define all(x) x.begin(),x.end() #define INF 5e18 #define eps 1e-9 #define x first #define y second usingnamespace std; int n; pii p[N];
ld dis(pii a, pii b){ ld x = a.x-b.x, y = a.y-b.y; returnsqrt(x*x + y*y); }
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a;i<=b;i++) #define pii pair<int,int> #define pdd pair<double,double> #define int long long #define ll long long #define ld long double #define N 100001 #define all(x) x.begin(),x.end() #define eps 1e-9 #define x first #define y second
usingnamespace std;
structpt{ int x,y; booloperator < (pt b){ if(x == b.x)return y < b.y; return x < b.x; } booloperator > (pt b){ if(x == b.x)return y > b.y; return x > b.x; } booloperator == (pt b){ if(x-b.x == 0 && y-b.y == 0)returntrue; returnfalse; } pt operator+(pt b) {return {x + b.x, y + b.y};} //向量相加 pt operator-(pt b) {return {x - b.x, y - b.y};} //向量相減 intoperator^(pt b) {return x * b.y - y * b.x;} //向量外積cross intoperator*(pt b) {return x * b.x + y * b.y;} //向量內積dot };
vector<pt> p,temp,pp; vector<int> cnt; int n,ans = 0;
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a;i<=b;i++) #define pdd pair<double,double> #define int long long #define ld long double #define N 15 #define x first #define y second usingnamespace std;
int n; pdd p[N];
ld check(pdd a, pdd b){ return a.x*b.y - a.y*b.x; }
#include<bits/stdc++.h> #define Orz ios::sync_with_stdio(0),cin.tie(0) #define rep(i,a,b) for(int i=a;i<=b;i++) #define pii pair<int,int> #define pdd pair<double,double> #define int long long #define ll long long #define ld long double #define N 100001 #define all(x) x.begin(),x.end() #define eps 1e-9 #define x first #define y second
usingnamespace std;
structpt{ int x,y; booloperator < (pt b){ if(x == b.x)return y < b.y; return x < b.x; } booloperator > (pt b){ if(x == b.x)return y > b.y; return x > b.x; } booloperator == (pt b){ if(x-b.x == 0 && y-b.y == 0)returntrue; returnfalse; } pt operator+(pt b) {return {x + b.x, y + b.y};} //向量相加 pt operator-(pt b) {return {x - b.x, y - b.y};} //向量相減 intoperator^(pt b) {return x * b.y - y * b.x;} //向量外積cross intoperator*(pt b) {return x * b.x + y * b.y;} //向量內積dot };
vector<pt> p,temp,pp; vector<int> cnt; int n,a,ans = 0;