2016 CCPC-Final
A.The Third Cup is Free
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read()
{
int x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
} /********************************************************************/ const int maxn = 1e5+;
int a[maxn]; bool cmp(int x, int y){
return x > y;
} int main(){
int t; t = read();
int cnt = ;
while(t--){
cnt++;
int n; n = read();
for(int i = ;i <= n;i++){
a[i] = read();
}
sort(a+, a++n, cmp);
int ans = ;
for(int i = ;i <= n;i++){
if(i% == ) continue;
ans += a[i];
}
printf("Case #%d: %d\n", cnt, ans);
}
return ;
}
B.Wash
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read(){
int x = , f = ; char ch = getchar();
while(ch > '' || ch < ''){if (ch == '-') f = -; ch = getchar();}
while(ch >= '' && ch <= ''){ x = x*+ch-''; ch = getchar();}
return x*f;
} /************************************************************************/ const int maxn = 1e6+;
ll c[maxn];
struct node{
ll v, base;
node(ll _v = , ll _base = ):v(_v), base(_base){}
bool operator < (const node &x) const{
return v > x.v;
}
}now, last; priority_queue<node>q1, q2; int main(){
int t; t = read();
int cnt = ;
while(t--){
while(!q1.empty()) q1.pop();
while(!q2.empty()) q2.pop();
cnt++;
int l, n, m;
l = read(); n = read(); m = read();
for(int i = ;i < n;i++){
ll x; x = read();
last.v = last.base = x;
q1.push(last);
}
for(int i = ;i < m;i++){
ll x; x = read();
last.v = last.base = x;
q2.push(last);
}
for(int i = ;i < l;i++){
last = q1.top(); q1.pop();
c[i] = last.v; //每一件洗完最小的时间
last.v += last.base;
q1.push(last);
}
ll ans = ;
for(int i = l-;i >= ;i--){
last = q2.top(); q2.pop();
ans = max(ans, last.v + c[i]);
last.v += last.base;
q2.push(last);
}
printf("Case #%d: %lld\n", cnt, ans);
}
return ;
}
L.Daylight Saving Time
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read(){
int x = , f = ; char ch = getchar();
while(ch > '' || ch < ''){if (ch == '-') f = -; ch = getchar();}
while(ch >= '' && ch <= ''){ x = x*+ch-''; ch = getchar();}
return x*f;
} /************************************************************************/ int GetWeekDay(int y, int m, int d){
if(m == ) m = , y--;
if(m == ) m = , y--;
int week = (d + *m + *(m + )/ + y + y/ - y/ + y/)%;
return week;
} int t, yy, mm, dd, h, m, s, week; void solve(){
if (mm < ) printf("PST\n");
else if (mm == ){
if (week == && dd > ){
if (h == ) printf("Neither\n");
else if (h > ) printf("PDT\n");
else if (h < ) printf("PST\n");
}
else if (dd-week > ) printf("PDT\n");
else printf("PST\n");
}
else if (mm > && mm < ) printf("PDT\n");
else if (mm == ){
if (week == && dd <= ){
if (h < ) printf("PDT\n");
else if (h == ) printf("Both\n");
else printf("PST\n");
}
else if (dd - week <= ) printf("PDT\n");
else printf("PST\n");
}
else printf("PST\n");
} int main(){
t = read();
int cnt = ;
while (t--){
scanf("%d-%d-%d %d:%d:%d", &yy, &mm, &dd, &h, &m, &s);
week = GetWeekDay(yy, mm, dd);
week++;
printf("Case #%d: ", ++cnt);
solve();
}
return ;
}
2016 CCPC-Final的更多相关文章
- 2016 CCPC 东北地区重现赛
1. 2016 CCPC 东北地区重现赛 2.总结:弱渣,只做出01.03.05水题 08 HDU5929 Basic Data Structure 模拟,双端队列 1.题意:模拟一个栈的操 ...
- HDU 5923 Prediction(2016 CCPC东北地区大学生程序设计竞赛 Problem B,并查集)
题目链接 2016 CCPC东北地区大学生程序设计竞赛 B题 题意 给定一个无向图和一棵树,树上的每个结点对应无向图中的一条边,现在给出$q$个询问, 每次选定树中的一个点集,然后真正被选上的是这 ...
- Atcoder CODE FESTIVAL 2016 Grand Final E - Water Distribution
Atcoder CODE FESTIVAL 2016 Grand Final E - Water Distribution 题目链接:https://atcoder.jp/contests/cf16- ...
- 2016 ccpc 网络选拔赛 F. Robots
Robots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Subm ...
- 2016 CCPC长春重现赛
1.2016中国大学生程序设计竞赛(长春)-重现赛 2.总结:会做的太少,应变能力也不行,或者说猜题目的能力不行 02 水 04 HDU 5914 Triangle 1.题意:1~n,n个数,问 ...
- 2016 CCPC 合肥赛区 平行四边形//打铁记录..... 背锅还是我在行 此处@ctr 233
也希望自己记住这些题并不是真的很难很难... 平行四边形... 这个题要两个直线上的两个点和给出点中的两个点组成的平行四边形面积最大. 确定两个点后,发现线上的点随之确定.那么我们解出线上的点 然后求 ...
- 2016 CCPC 杭州站 小结
5题倒数第一,铜……(我就知道我们很稳!!!哼!! 这一次心态完全爆炸 开场我就没有按照平时的顺序读题 然后zr的A题wa 我F题T xl说B是一个最小生成树,又说是最小树形图,不会写 K题完全没思路 ...
- HDU 5918 SequenceI (2016 CCPC长春站 KMP模版变形)
这个题目的数据应该是比较弱的,赛场上的时候我们暴力也过了,而且我的kmp居然比暴力还要慢-- 这个变形并不难,跳着选数,把漏掉的位置补上就可以了. 代码如下: #include<iostream ...
- 2016 ccpc 杭州赛区的总结
毕竟是在杭电比的,和之前大连的icpc不同,杭电毕竟是隔壁学校,来回吃住全都是在自家寝室,方便! 不过说到方便也是有点不方便,室友都喜欢玩游戏,即使我昨晚9.30就睡觉了,仍然是凌晨一点才睡着,233 ...
- HDU 5984.Pocky(2016 CCPC 青岛 C)
Pocky Let’s talking about something of eating a pocky. Here is a Decorer Pocky, with colorful decora ...
随机推荐
- (2)struts2配置祥解
struts工作流程 反射 : 1.构造对象使用构造器 //类似为Servlet public class AddAction { public AddAction(){ System.out.pri ...
- Spark- Linux下安装Spark
Spark- Linux下安装Spark 前期部署 1.JDK安装,配置PATH 可以参考之前配置hadoop等配置 2.下载spark-1.6.1-bin-hadoop2.6.tgz,并上传到服务器 ...
- wordpress,cos-html-cache静态化后,点击数失效问题的解决方案
装了wordpress cos-html-cache 静态插件后,生成了静态文件,post-views等点击数插件就失效了, 找了一些,包括有个js版本的,需要用到post-views插件,我也不想装 ...
- SENet(Squeeze-and-Excitation Networks)算法笔记---通过学习的方式来自动获取到每个特征通道的重要程度,然后依照这个重要程度去提升有用的特征并抑制对当前任务用处不大的特征
Momenta详解ImageNet 2017夺冠架构SENet 转自机器之心专栏 作者:胡杰 本届 CVPR 2017大会上出现了很多值得关注的精彩论文,国内自动驾驶创业公司 Momenta 联合机器 ...
- ES BM25 TF-IDF相似度算法设置——
Pluggable Similarity Algorithms Before we move on from relevance and scoring, we will finish this ch ...
- android自定义控件(四) View中的方法
onFinishInflate() 当View中所有的子控件 均被映射成xml后触发 onMeasure(int, int) 确定所有子元素的大小 onLayout(boolean, int, int ...
- eclipse 通过maven 开发storm项目
window系统安装java 首先我们需要下载java开发工具包JDK,下载地址:http://www.oracle.com/technetwork/java/javase/downloads/ind ...
- uC/OS-II源码分析(三)
首先来了解下实时系统的基本概念: 1) 临界区,共享资源,任务(类似于进程),任务切换,任务调度,可剥夺型内核,可重入函数,动态优先级调度, 2) 如何处理优先级反转问题.这个问题描述如下:有三个任务 ...
- windows平台下新网络库RIO ( Winsock high-speed networking Registered I/O)
What's New for Windows Sockets Microsoft Windows 8 and Windows Server 2012 introduce new Windows Soc ...
- opencvsharp BitmapSource图片截取问题
private BitmapSource GetUiImage(FrameworkElement ui) { RenderTargetBitmap bmp=new RenderTargetBitmap ...