wisdom2010 @ 2024-10-07 21:15:08
#include<bits/stdc++.h>
using namespace std;
const int maxn = 50 + 5;
int n;
int h[maxn];
int x;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 1; i <= n; i++)
cin >> h[i];
sort(h, h + n);
int l = 1, r = n;
int mid;
cin >> x;
while(l + 1 < r)
{
mid = (l + r) / 2;
if(h[mid] > x)
r = mid - 1;
else
l = mid + 1;
}
cout << l << "\n";
return 0;
}
by cfkk @ 2024-10-08 20:44:12
@wisdom2010 sort写错了,再说用暴力就行吧