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 ...
随机推荐
- VC DLL方法的__declspec导入导出
https://msdn.microsoft.com/zh-cn/library/a90k134d.aspx https://msdn.microsoft.com/zh-cn/library/ms23 ...
- 从mediaserver入手快速理解binder机制(最简单理解binder)【转】
本文转载自;https://blog.csdn.net/u010164190/article/details/53015194 Android的binder机制提供一种进程间通信的方法,使一个进程可以 ...
- FZU1989 AntiAC —— 字符串
题目链接:https://vjudge.net/problem/FZU-1989 Problem 1989 AntiAC Accept: 79 Submit: 399Time Limit: 4 ...
- OpenGL几何变换---翻译http://www.songho.ca/opengl/gl_projectionmatrix.html
Overview 几何数据——顶点位置,和法向量(normal vectors),在OpenGL 管道raterization 处理过程之前可通过顶点运算(Vertex Operation)和基本组合 ...
- python学习笔记:第八天(模块)
Python3 模块 脚本上是用 python 解释器来编程,如果从 Python 解释器退出再进入,那么定义的所有的方法和变量就都消失了. 为此 Python 提供了一个办法,把这些定义存放在文件中 ...
- swift的泛型貌似还差点意思
protocol Container { typealias ItemType mutating func append(item: ItemType) mutating func removelas ...
- star score
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http ...
- BZOJ_2813_奇妙的Fibonacci_线性筛
BZOJ_2813_奇妙的Fibonacci_线性筛 Description Fibonacci数列是这样一个数列: F1 = 1, F2 = 1, F3 = 2 . . . Fi = Fi-1 + ...
- loj 6089 小 Y 的背包计数问题——分类进行的背包
题目:https://loj.ac/problem/6089 直接多重背包,加上分剩余类的前缀和还是n^2的. 但可发现当体积>sqrt(n)时,个数的限制形同虚设,且最多有sqrt(n)个物品 ...
- HL7 ADT Message Sample
http://pixpdqtests.nist.gov:8080/#tests%2Fdriver%2Fversion.htm 可以打开上述连接, 选中version和actor, 然后获取对于samp ...