#include <bits/stdc++.h>us...
发布于 2022-03-03 14:11:42
#include <bits/stdc++.h>
using namespace std
int main() {
int n
scanf("%d", &n)
map <int, int> xs
map <int, int> ys
map < pair <int, int>, int > zs
long long ans = 0
for (int i = 0 i < n i++) {
int x, y
scanf("%d %d", &x, &y)
ans += (xs[x]++)
ans += (ys[y]++)
ans -= (zs[make_pair(x, y)]++)
}
cout << ans << endl
return 0
}
输入:
6
0 0
0 1
0 2
-1 1
0 1
1 1
则上述程序输出为( )
using namespace std
int main() {
int n
scanf("%d", &n)
map <int, int> xs
map <int, int> ys
map < pair <int, int>, int > zs
long long ans = 0
for (int i = 0 i < n i++) {
int x, y
scanf("%d %d", &x, &y)
ans += (xs[x]++)
ans += (ys[y]++)
ans -= (zs[make_pair(x, y)]++)
}
cout << ans << endl
return 0
}
输入:
6
0 0
0 1
0 2
-1 1
0 1
1 1
则上述程序输出为( )
登录后免费查看答案
关注者
0
被浏览
23