蒟蒻的第一篇题解... 先结构体排序再暴力 容易看懂些,其他神犇的我看不懂.. 呜呜

签订协议

https://ac.nowcoder.com/acm/contest/11038/B

include<bits/stdc++.h>

using namespace std;
const int maxn = 1e6+9;
struct node
{
int no;
int zhan;
}stu[maxn];
bool cmp(node a,node b)
{
return a.zhan>b.zhan;
}
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>stu[i].zhan;
stu[i].no=i;
}
sort(stu+1,stu+n+1,cmp);
int ans=0;
for(int i=1;i<n;i++)
{
if(stu[i].no>stu[i+1].no)ans++;
}
ans++;
cout<<ans<<endl;
return 0;
}

全部评论

相关推荐

点赞 评论 收藏
分享
流浪的神仙:无恶意,算法一般好像都得9硕才能干算法太卷啦
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务