AcWing
  • 首页
  • 活动
  • 题库
  • 竞赛
  • 校园
  • 应用
  • 文章
    • 题解
    • 分享
    • 问答
  • 吐槽
  • 登录/注册

struct??????



3


请求帮助,这个struct是什么鬼???

结构体里面的这玩意????

#include<bits/stdc++.h>
using namespace std;
int n;
struct node{
    int l,r;
    bool operator<(const node &W)const{
        return r<W.r;
    }

}a[10000001];
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i].l>>a[i].r;
    sort(a,a+n);
    int res=0,ed=-2e9;
    for(int i=0;i<n;i++){
        if(ed<a[i].l){
            res++;
            ed=a[i].r;
        }
    }
    cout<<res;
}


提问于16天前
迎风飘扬
23123

所以为什么要拿我的code呢???(逃 –  AcWing2AK   16天前



4 个问答



1

大家应该是误解了我同学的问题。。。
他问的是结构体里面这个是什么……
这是重载运算符,也就是相当于你在排序结构体数组的时候用到的$cmp$函数一样。
这样就可以直接用$sort$了。
希望某同学以后自己能解决的问题不要再浪费AcWing资源了hh

回答于15天前
封禁用户
116759

@封禁用户:  为啥要拿我的代码丢人呐qwq –  AcWing2AK   1天前

@迎风飘扬:  懂了吗 –  封禁用户   15天前

你什么意思 –  迎风飘扬   15天前



1

结构体

回答于16天前
AcWing2AK
63719


0

struct是结构体 里面的是重载运算符吧

回答于15天前
loverinA…
6214


0

请求帮助,这个struct是什么鬼???
结构体里面的这玩意????

struct == 结构体

回答于15天前
itdef
311535

我来回答
你确定删除吗?
1024
x

© 2018-2022 AcWing 版权所有  |  京ICP备17053197号-1
用户协议  |  常见问题  |  联系我们
AcWing
请输入登录信息
更多登录方式: 微信图标 qq图标
请输入绑定的邮箱地址
请输入注册信息