1 条题解
-
0
C++ :
#include<iostream> #include<algorithm> using namespace std; const int N = 51; int available[N], number[N]; int main() { int n, k, p; int i, color, money; long long ans = 0; cin >> n >> k >> p; for (i = 1; i <= n; i++) { cin >> color >> money; if (money <= p) copy(number, number + N, available); ans += available[color]; if (money <= p) available[color]++; number[color]++; } cout << ans << endl; return 0; }Pascal :
var a,b:array[0..50] of longint; i,j,k,m,n,s,t:longint; begin readln(n,k,m); j:=0; fillchar(a,sizeof(a),0); for i:=1 to n do begin readln(s,t); a[s]:=a[s]+1; if t<=m then begin b:=a; j:=j+b[s]-1; end else j:=j+b[s]; end; write(j); end.
- 1
信息
- ID
- 1601
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者