您当前的位置: 首页 > 

先求一个导

暂无认证

  • 1浏览

    0关注

    291博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

L2-3 清点代码库 (25 分) (做水题是吧?抓紧reborn吧,爪巴)

先求一个导 发布时间:2021-10-07 22:37:36 ,浏览量:1

在这里插入图片描述 题意: 给定n个长度为m的数字序列,统计有多少种不同的数字序列。要求按照同一种类的个数的降序排序,如果两种序列的个数相同,按照数字序列大小的升序排序。 思路: map维护数量,最后赛到set里排序。重载set排序,涨知识.(虽然直接数组排也一样) 代码:

#include
using namespace std;
const int N = 1e4+10;
int n,m,k,T;
//-------------------------------
struct cmp{
	bool operator() (const pair & a,const pair &b)
	{
		if(a.second != b.second)
		{
			return a.second > b.second;
		}
		return a.first >n>>m;
	for(int i=0;iva[j];
		}
		mp[va] ++ ;
	}
	for(auto item:mp)
	{
	    sa.insert({item.first,item.second});
	}
	cout            
关注
打赏
1662037414
查看更多评论
0.0374s