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 ...
随机推荐
- 【LeetCode】种花问题
假设你有一个很长的花坛,一部分地块种植了花,另一部分却没有.可是,花卉不能种植在相邻的地块上,它们会争夺水源,两者都会死去. 给定一个花坛(表示为一个数组包含0和1,其中0表示没种植花,1表示种植了花 ...
- 算法(Algorithms)第4版 练习 1.3.12
方法实现: package com.qiusongde; import java.util.Iterator; import java.util.NoSuchElementException; imp ...
- Strom 消息处理机制 中英对照翻译 (Storm如何保证消息被完全处理)
官方链接: http://storm.incubator.apache.org/documentation/Guaranteeing-message-processing.html What does ...
- html5 手写的canvas实现
试用支持canvas的浏览器,无JS依赖,运用新的HTML5技术DrawBoard.renderDrawer('myHandWrite',{ penColor:'#FF0000', penWidt ...
- 设置document.domain实现js跨域注意点
转自:http://www.cnblogs.com/fsjohnhuang/archive/2011/12/07/2279554.html document.domain 用来得到当前网页的域名.比如 ...
- Linux_服务器_05_CentOS 7安装完成后初始化的方法_Linux
参考资料 1.CentOS 7安装完成后初始化的方法_Linux
- Java中内部类中使用外面变量为什么final修饰?
所以final从语法上约束了实际上两个不同变量的一致性(表现为同一变量). 我的理解: 例如这样的代码: public void test(String str){ str="abc&quo ...
- 2018.2.27 RF module distance test part I
Last week,we finish 20 pcs EP2 sample for RF module, Fistly,we need to test PCBA performance test ...
- Katalon Recorder 自动录制 Selenium 爬虫脚本
相信很多小伙伴都用过 Selenium 来完成爬虫工作,今天就给大家带来一个神器,可以录制你的浏览器动作,然后直接生成 Selenium 脚本,是不是心动了? 1 Selenium 简介 Seleni ...
- 「P3385」【模板】负环(spfa
题目描述 暴力枚举/SPFA/Bellman-ford/奇怪的贪心/超神搜索 输入输出格式 输入格式: 第一行一个正整数T表示数据组数,对于每组数据: 第一行两个正整数N M,表示图有N个顶点,M条边 ...