标签:struct 裸题 std nod for ace return def end
裸题:https://ac.nowcoder.com/acm/contest/5929/B
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
int n;
struct node{
int val,id;
bool operator < (const node &b) const{
if(val!=b.val)
return val<b.val;
else
return id<b.id;
}
}a[100000+50];
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&a[i].val),a[i].id=i;
sort(a+1,a+n+1);
cout<<lower_bound(a+1,a+n+1,(node){-100,0})-a<<endl;
cout<<lower_bound(a+1,a+n+1,(node){-2,0})-a<<endl;
cout<<lower_bound(a+1,a+n+1,(node){1,0})-a<<endl;
cout<<lower_bound(a+1,a+n+1,(node){100,0})-a<<endl;
}
标签:struct 裸题 std nod for ace return def end
原文地址:https://www.cnblogs.com/xiaoxiao179/p/13195039.html