我的涨分日记(二)——BestCoder Round #59
哎呀,好久没有更新博客啦,今天又刷了一波BC,而且又涨分,还是蛮开心的。
近来很多人告知了我的不足,我也渐渐体会到自己小题做的越来越好了,但是大题还是没有思路。
肯定是我光刷小题,不去学算法,大题也做的不多,结果才会这样。
虽说学算法是个日积月累的过程,但我看我要抓紧步伐,开始一些比较难一点的算法的学习了。
HDU-5499 SDOI
看不懂英文的同学去Bestcoder里面看中文版把(我估计英文版做出来是够呛的)
思路:这道题目不是特别难,但是特别烦,假设这不是一道中文题,让我用英文来看的话,我不知道自己还能不能很快做出来,甚至能不能做出来。我的话比较习惯用结构体排序。先读取数据,将两次最高的分数保存,如果遇到女性用flag记录。然后再计算一遍每个人的最终分数,排序!最后就是将最佳女选手挑出,如果flag记录了,那么就从前往后查找第一个女性选手。如果她在前m个,那么就不用移动;但是如果她不在前m个,那么就将她与第m个选手交换位置。输出答案!
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <string>
#include <vector>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <sstream>
#include <cstring>
#include <iostream>
#include <algorithm>
#pragma comment(linker, "/STACK:1024000000,1024000000")using namespace std;
#define clr(x,y) memset(x,y,sizeof(x))
#define maxn 100+5
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
typedef long long ll;struct man
{char name[25];int sex,r1,r2;double r;friend bool operator < (const man& A,const man& B){return A.r > B.r;}
}a[maxn];int main()
{int t,n,m;scanf("%d",&t);while(t--){int flag=0,ma1=0,ma2=0;scanf("%d %d",&n,&m);for(int i=0;i<n;i++){char k[10];scanf("%s %s %d %d",a[i].name,k,&a[i].r1,&a[i].r2);ma1=max(ma1,a[i].r1);ma2=max(ma2,a[i].r2);if(k[0]=='m')a[i].sex=1;else a[i].sex=0,flag=1;}for(int i=0;i<n;i++)a[i].r=(1.0*a[i].r1/ma1)*300*0.3+(1.0*a[i].r2/ma2)*300*0.7;sort(a,a+n);if(flag){for(int i=0;i<n;i++){if(!a[i].sex){if(i+1>m){swap(a[i],a[m-1]);}break;}}}puts("The member list of Shandong team is as follows:");for(int i=0;i<m;i++)printf("%s\n",a[i].name);}return 0;
}
HDU- 5500 Reorder the Books
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <string>
#include <vector>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <sstream>
#include <cstring>
#include <iostream>
#include <algorithm>
#pragma comment(linker, "/STACK:1024000000,1024000000")using namespace std;
#define clr(x,y) memset(x,y,sizeof(x))
#define maxn 100+5
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
typedef long long ll;int a[30];
int main()
{int t;scanf("%d",&t);while(t--){int n;scanf("%d",&n);for(int i=1;i<=n;i++)scanf("%d",a+i);int k=n;for(int i=n;i>=1;i--)if(a[i]==k)k--;printf("%d\n",k);}return 0;
}
HDU-5501 The Highest Mark
我的涨分日记(二)——BestCoder Round #59相关推荐
- (BestCoder Round #59 (div.1) B)简单DP
(改编版,题意相同) Description 火神为了检验zone的力量,他决定单挑n个人. 由于火神训练时间有限,最多只有t分钟,所以他可以选择一部分人来单挑,由于有丽子的帮助,他得到了每个人特定的 ...
- hdu4585 amp; BestCoder Round #1 项目管理(vector应用)
主题链接:http://acm.hdu.edu.cn/showproblem.php?pid=4858 项目管理 Time Limit: 2000/1000 MS (Java/Others) M ...
- 矩阵快速幂---BestCoder Round#8 1002
当要求递推数列的第n项且n很大时,怎么快速求得第n项呢? 可以用矩阵快速幂来加速计算. 我们可以用矩阵来表示数列递推公式 比如fibonacci数列 可以表示为 [f(n) f(n-1)] = [ ...
- hdu4932 Miaomiao#39;s Geometry (BestCoder Round #4 枚举)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4932 Miaomiao's Geometry Time Limit: 2000/1000 MS (Ja ...
- 贪心/二分查找 BestCoder Round #43 1002 pog loves szh II
题目传送门 1 /* 2 贪心/二分查找:首先对ai%=p,然后sort,这样的话就有序能使用二分查找.贪心的思想是每次找到一个aj使得和为p-1(如果有的话) 3 当然有可能两个数和超过p,那么an ...
- 贪心 BestCoder Round #39 1001 Delete
题目传送门 1 /* 2 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少: 3 否则再在tot里减去多余的即为答案 4 用set容器也可以做,思 ...
- HDU 5228 ZCC loves straight flush( BestCoder Round #41)
题目链接:ZCC loves straight flush 题面: ZCC loves straight flush Time Limit: 2000/1000 MS (Java/Others) ...
- puppet成长日记二 Package资源详细介绍及案例分析
puppet成长日记二 Package资源详细介绍及案例分析 一.系统环境 1.puppet服务端 Release:RHEL6.4 HOSTNAME: puppetserver.rsyslog.org ...
- 字符串处理 BestCoder Round #43 1001 pog loves szh I
题目传送门 1 /* 2 字符串处理:是一道水题,但是WA了3次,要注意是没有加'\0'的字符串不要用%s输出,否则在多组测试时输出多余的字符 3 */ 4 #include <cstdio&g ...
最新文章
- R语言时间序列(time series)分析实战:霍尔特指数Holt‘s平滑法预测
- 配置Tomcat6的管理用户
- SectionIndexer中的getSectionForPosition()与getPositionForSection()
- 鸿蒙系统会支持youtube吗,华为鸿蒙系统,会受到人们的欢迎吗?
- Python模块: 文件和目录os+shutil
- WebLogic在Linux环境下安装
- **Dijkstra算法**
- 2021年上半年软考真题网络工程师真题及答案解析
- Python升级包不成功,试试豆瓣资源吧
- plc控制伺服电机 四轴攻丝机案例 该程序为plc控制伺服电机的工程案例程序,包含伺服电机接线图,包含程序流程的详细解释说明
- 对RS232接口的详细攻破
- 离线地图三维立体建筑物实现
- Baas是什么?区块链Baas平台开发解决方案带你知晓
- 布兰迪斯大学计算机美国大学排名,美国大学排名 布兰迪斯大学排名汇总
- 软碟通 刻录linux光盘,使用UltraISO软碟通刻录光盘
- VScode已经设置了默认浏览器依然不成功原因
- 快速拔h型钢拔桩机 H型钢建筑拔桩机应用特点
- 面向对象:余愿,知你冷暖,懂你悲欢,与你共黄昏,也能问你粥可温
- bash运行.sh文件出现 command not found: XX某变量名
- 两小时狂赚1000万!这一切怎么“成功”完成?