首先天梯赛175是基操,在这个基础上,pta达到企业要求相当于就是特招了,也就是他不会占用你这个批次的名额。
将这些特招排除之后,假设175这个线还有x个人,需要s人,那么在就会要s个人(x>s,x<s那就是这个线的人全要了)。
写法一:
#include <bits/stdc++.h>
using namespace std;
int score[100010];
int main() {
int n, k, s;
cin >> n >> k >> s;
int count = 0;
for (int i = 0; i < n; i++) {
int base, pta;
cin >> base >> pta;
if (base < 175) continue;
if (pta >= s) {
count++;
}
else {
if (score[base] < k) {
score[base]++;
count++;
}
}
}
cout << count << endl;
return 0;
}
写法二:
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, k, s; cin>>n>>k>>s;
int a[300]={0}, sum = 0;
for(int i = 1; i <= n; i++){
int x, y; cin>>x>>y;
if(x>=175 && y>=s)sum++;
if(x>=175 && y<s)a[x]++;
}
for(int i = 175; i <= 290; i++){
if(a[i]==0)continue;
if(a[i]<=k)sum += a[i];else sum += k;
}
cout<<sum<<"\n";
return 0;
}
参考博客: https://blog.csdn.net/m0_75081848/article/details/129220945
标签:count,088,int,++,pta,静静的,base,L1,175 From: https://www.cnblogs.com/chengyiyuki/p/18106208