1 条题解
-
0
C++ :
#include <cstdio> #include <algorithm> using namespace std; static int a[5005]; int main(){ int n; if(scanf("%d", &n) != 1) return 0; for(int i = 0; i < n; i++) scanf("%d", &a[i]); sort(a, a + n); long long ans = 0; for(int i = 0; i < n; ){ int j = i; while(j < n && a[j] == a[i]) j++; ans += (j - i) / 4; /* 同长度 4 根拼一个正方形 */ i = j; } printf("%lld\n", ans); return 0; }
- 1
信息
- ID
- 2608
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者