#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n, m, p;
struct student
{
int x, y;
double sum;
}a[100001];
bool cmp(student a, student b)
{
return a.sum > b.sum;
}
int main()
{
cin >> n >> m >> p;
for(int i = 0; i < n; i++)
{
scanf("%d %d",&a[i].x, &a[i].y);
a[i].sum = a[i].x*0.85 + a[i].y * 0.15;
}
sort(a, a+n, cmp);
double x = (a[m-1].sum - p*0.15) / 0.85;
//printf("%d\n",(int)c+1);
x = max(x,0.0);//防止校测的成绩就大于m-1同学的总成绩了(这个地方一直wa,遇到这样的情况一定要想想什么情况)
if(int(x)==x)//if(x - (int)x < 1e-1)也可以
cout<<int(x);
else
cout<<int(x)+1;
return 0;
}
另一个
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100005
#define int long long
int n,m,p;
int a[MAXN];
bool cmp(int x,int y) {
return x>y;
}
signed main()
{
cin >> n >> m >> p;
for(int i = 1; i <= n; i ++) {
int x,y;
cin >> x >> y;
a[i] = x*85+y*15;//好像没必要一定用double 打破固定思维
}
sort(a+1,a+n+1,cmp);
int ans = (a[m]-p*15-1)/85 + 1;//括号里的 -1(减1) 没必要 一样ac
if((a[m]-p*15) <= 0) cout<<0<<"\n";
else cout<<ans<<"\n";
return 0;
}