L2-3 名人堂与代金券 (25 分)
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int N, G, K;
struct P{
char name[20];
int score;
bool operator <(const P&a)const &{
if (score != a.score)
return score > a.score;
else
return strcmp(name, a.name)<0;
}
}s[10000+10];
int main() {
//freopen("in.txt", "r", stdin);
scanf("%d %d %d", &N, &G, &K);
for (int i = 0; i < N; i++)
scanf("%s %d", s[i].name, &s[i].score);
sort(s, s + N);
int s60 = 0, sg = 0;
for (int i = 0; i < N; i++) {
if (s[i].score >= G)
sg++;
else if (s[i].score >= 60)
s60++;
else break;
}
printf("%d\n", sg * 50 + s60 * 20);
//重点处理方法
int c = 1,ca=0;
for (int i = 0; i < K; i++) {
printf("%d %s %d\n", c, s[i].name, s[i].score);
while (s[i + 1].score == s[i].score) {
i++;
printf("%d %s %d\n", c, s[i].name, s[i].score);
ca++;
}
c++;//正常加一
c += ca;//加上重复
ca = 0;
} return 0;
}
L2-3 名人堂与代金券 (25 分)的更多相关文章
- L2-027. 名人堂与代金券
链接:名人堂与代金券 在比赛中这题只得了2分,赛后发现原来strcmp函数并不是只返回-1,0,1三种,而是返回正数负数0 但是在我的电脑上一般就是返回前三种,只是用后面的三种更稳妥点 都怪我基础不扎 ...
- 2018 L2-027. 名人堂与代金券【结构体排序】
L2-027. 名人堂与代金券 时间限制 150 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 对于在中国大学MOOC(http://www.i ...
- PAT L2-027 名人堂与代金券
https://pintia.cn/problem-sets/994805046380707840/problems/994805055176163328 对于在中国大学MOOC(http://www ...
- PAT-GPLT L2-027 - 名人堂与代金券 - [简单模拟]
题目链接:https://www.patest.cn/contests/gplt/L2-027 对于在中国大学MOOC(http://www.icourse163.org/)学习“数据结构”课程的学生 ...
- PAT天梯赛 L2-027. 名人堂与代金券 【排序】
题目链接 https://www.patest.cn/contests/gplt/L2-027 思路 在输入的时候 判断分数 是否符合领取代金券条件 如果符合 SUM 就加上对应的代金券价值 然后在对 ...
- L2-3 名人堂与代金券
题解 这题的话,每一个人都要占一个排名,即使排名并列了. 对于最后一个排名来说,即使人数超过了指定的k,也要加入. 代码 #include <bits/stdc++.h> using na ...
- WeMall微信商城源码插件代金券部分代码
WeMall微信商城源码插件Coupon代金券代码是用于商业推广的比较有效的方式,分享了部分比较重要的代码,供技术员学习参考 AdminController.class.php <?php na ...
- UPYUN云服务体验计划,阅读神器Kindle、LaCie移动硬盘、索尼大法充电宝、高大上极路由、UPYUN代金券等你拿!
请看以下的“通关攻略”,分享你对云服务的“体验心得”,即可赢取绝佳的“通关宝藏”,阅读神器Kindle.LaCie移动硬盘.索尼大法充电宝.高大上极路由.UPYUN代金券等你拿!先来了解下UPYUN能 ...
- L2-006 树的遍历 (25 分) (根据后序遍历与中序遍历建二叉树)
题目链接:https://pintia.cn/problem-sets/994805046380707840/problems/994805069361299456 L2-006 树的遍历 (25 分 ...
随机推荐
- [Schema] I have updated my XML Schema for my service but SoapUI still generates/validates according to the old schema.
SoapUI caches XML schemas when they are first loaded. If you need to force a reload of an interfaces ...
- js闭包原理与例子[转]
闭包(closure)是Javascript语言的一个难点,也是它的特色,很多高级应用都要依靠闭包实现. 一.闭包原理: 一.变量的作用域 要理解闭包,首先必须理解Javascript特殊的变量作用域 ...
- https://itunes.apple.com/cn/app/apache-overkill/id410553807?mt=8uo%3D6
https://itunes.apple.com/cn/app/apache-overkill/id410553807?mt=8uo%3D6 http://eplusgames.net/games/s ...
- idea中dependencies中总是有红色波浪线(缺少dependency)问题
使用IDEA进行maven开发时,将新项目import进工作空间时,Maven Projects栏中的dependencies中总是有红色波浪线,如下图: 但是这些jar在我本地的maven仓库中实际 ...
- Word2010如何编辑好了直接发布csdn博文?
目前大部分的博客作者在写博客这件事情上都会遇到以下3个痛点:1.所有博客平台关闭了文档发布接口,用户无法使用Word,Windows Live Writer等工具来发布博客.2.发布到博客或公众号平台 ...
- Arch Linux 使用markdown
Arch Linux 使用markdown pandoc 文档格式转换 pygments 代码高亮 markdown-mode.el 配置emacs pandoc 号称文件格式转换的瑞士军刀,这里主要 ...
- MySQL的下载和安装
MySQL的下载 MySQL官网:https://www.mysql.com/ MySQL的安装 https://jingyan.baidu.com/article/6181c3e0d27a57152 ...
- 电脑连接真机,但是androidstudio不显示手机,ADB Interface黄色感叹号
1.打开设备管理器 右键计算机 -->管理-->选择设备管理器 2. 步骤如下: 1. 在设备管理器中,找到ADB Interface,右击,选择“更新驱动程序软件” 2. 在弹出的窗口中 ...
- js ~或者~~
问题:~是什么意思? 答:js中是对数字取反 var a = null; var b = '23' console.log(~~null) console.log(~~b)
- Spring Boot - Spring Async
除了使用Thread.Runnable.TimerTask.FeatureTask.CompletableFuture等类,在Spring Boot中还可以使用注解创建异步任务,可以减少线程处理的代码 ...