当前位置:网站首页>L2-021 点赞狂魔 (25 分)
L2-021 点赞狂魔 (25 分)
2022-04-23 00:33:00 【hys__handsome】
题目详情 - L2-021 点赞狂魔 (25 分) (pintia.cn)
题目有个坑点:标签出现次数平均值,是:总数 除以 不同数 。
结构体排序+set
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
const int N = 110;
struct Node{
string name;
int cnt;
int sum;
bool operator<(const Node& t) const{
if(cnt != t.cnt) return cnt > t.cnt;
return sum < t.sum;
}
}a[N];
int main(){
int n;
cin>>n;
for(int i = 0; i < n; i++){
string name;
int k;
set<int> s;
cin>>name>>k;
for(int i = 0; i < k; i++){
int fk; cin>>fk;
s.insert(fk);
}
int cnt = s.size();
a[i] = {name,cnt,k};
}
sort(a,a+n);
for(int i = 0; i < 3; i++){
if(i) cout<<' ';
if(i > n-1) cout<<"-";
else cout<<a[i].name;
}
return 0;
}
版权声明
本文为[hys__handsome]所创,转载请带上原文链接,感谢
https://blog.csdn.net/hys__handsome/article/details/124344338
边栏推荐
- thymeleaf 的templates子集目录下不能引入common公共页面,否则报错:模板解析错误,错误原因:公共页面的引用路径错误(缺少子目录名)
- Add a route between two CX controllers of Beifu
- Process comma separated strings and sort the output in ascending dictionary order
- 湖泊遥感研究进展(概述)
- 牛客NC13251模
- 洛谷P2241统计方形
- Learning Android 8 from scratch -- threads and services
- Unittest unit test (6)
- Openresty installation and introduction
- Progrès de la recherche sur la télédétection des paramètres phénologiques de la végétation
猜你喜欢

CAS unified identity authentication (II): overlay configuration management

Analysis and application of conditional compilation

ArcGIS urban living area land suitability evaluation (III)

Addition, deletion, modification and query of MySQL table (Advanced)

ArcGIS 计算地块容积率

JS - process and split the data of consecutive months

对Indexlookup的理解误区

(transfer) how winscp (SSH FTP client) generates the key to log in Linu

Nodejs + Express login authentication and registration

R language data analysis from entry to advanced: (9) data table connection of data cleaning skills
随机推荐
ArcGIS 地表TIN面数据的符号化
Two methods are used to realize mongodb self increment ID, and the second one is recommended
ArcMAP 空间连接和相交工具使用
基于.NetCore开发博客项目 StarBlog - (2) 环境准备和创建项目
C# WPF UI框架MahApps切换主题
MySQL安装及基本使用教程
Download net framework process on Microsoft official website
Mp2459 is a perfect replacement for 60v0 with power MOSFET fs2459 integrated inside 5A step-down IC
Usage of while (n -- > 0)
C#/.Net 使用QuestPDF操作生成PDF更快更高效!
Nodejs + Express login authentication and registration
thymeleaf 的templates子集目录下不能引入common公共页面,否则报错:模板解析错误,错误原因:公共页面的引用路径错误(缺少子目录名)
c#可变参数params的介绍
(transfer) remote access to window remote desktop win10 through external network
我和TiDB的故事 | 毫无准备地不期而遇,却想说与你相遇好幸运
Beifu el6631 and Siemens 1200 do PROFINET master-slave communication
(transfer) how winscp (SSH FTP client) generates the key to log in Linu
Detailed introduction of Mitsubishi mr-je-c servo application
Object size and pointer compression -- JVM
[play with lighthouse] build a temporary mailbox system that can be collected and destroyed immediately