CCPC吉林站
A.The Fool
#include <bits/stdc++.h>
using namespace std; 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;
} /********************************************************************/ int main(){
int t; t = read();
int cnt = ;
while(t--){
cnt++;
int n; n = read();
int last = ;
int ans = ;
for(int i = ;i <= n;i = last){
int j = n/(n/i);
ans += (j-i+)*(n/i);
last = j+;
}
if(n&) printf("Case %d: odd\n", cnt);
else printf("Case %d: even\n", cnt);
}
return ;
}
B.The World
模拟
C.Justice
//似乎卡过去了,可能需要更优化 #include <bits/stdc++.h>
using namespace std; 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+; struct node{
int id;
int val;
vector<int>son;
}now; vector<node>a;
int num[maxn]; bool cmp(node x, node y){
return x.val < y.val;
} int main(){
int t = read();
int cnt = ;
while(t--){ memset(num, , sizeof(num));
a.clear();
cnt++;
int n = read();
for(int i = ;i <= n;i++){
now.val = read();
now.id = i;
now.son.clear();
a.push_back(now);
} printf("Case %d: ", cnt);
if(n == ){ printf("NO\n"); continue;}
bool ok = true;
sort(a.begin(), a.end(), cmp);
while(ok){
//sort(a.begin(), a.end(), cmp);
if(a.size() == ) break;
if(a[].val == && a[].val == ) break;
ok = false;
vector<node>::iterator it = a.end()-;
for(;it != a.begin();it--){
if((*it).val == ) continue;
if((*it).val == (*(it-)).val){
ok = true;
vector<node>::iterator it1 = it-;
int itlen = (*it).son.size();
for(int j = ;j < itlen;j++){
(*it1).son.push_back((*it).son[j]);
}
(*it1).son.push_back((*it).id);
(*it1).val--;
/*
sort((*it1).son.begin(), (*it1).son.end());
(*it1).son.erase(unique((*it1).son.begin(), (*it1).son.end()), (*it1).son.end());
*/
a.erase(it);
it++;
}
if(a.size() == ) break;
}
sort(a.begin(), a.end(), cmp);
}
/*
for(int i = 0; i<a.size();i++){
cout << i+1 << " : " << a[i].val << endl;
}
*/
if(a[].val == && a[].val == ){
printf("YES\n");
int valen = a[].son.size();
num[a[].id] = ;
for(int i = ;i < valen;i++){
num[a[].son[i]] = ;
}
for(int i = ;i <= n;i++)
printf("%d", num[i]);
printf("\n");
}
else printf("NO\n"); }
return ;
}
CCPC吉林站的更多相关文章
- 2018 CCPC 吉林站 H Lovers
2018 CCPC 吉林站 H Lovers 传送门:https://www.spoj.com/problems/LIS2/en/ 题意: q次操作 1.将第l~r个数的左边和和右边都加上一个数d, ...
- 2018年9月22日CCPC吉林站参赛总结
发现思维题是硬伤,代码能力是硬伤,对知识点的理解不深刻是硬伤 接下来要做的就是 1.熟悉每一个知识点,把每一个知识点和实现它的代码联系在一起学习 2.多见题,看看他们是怎么考察这些知识点的,等比赛的时 ...
- 2018 CCPC 吉林站 H Lovers || HDU 6562 (线段树哦)
http://acm.hdu.edu.cn/showproblem.php?pid=6562 题意: q次操作 1.将第l~r个数的左边和和右边都加上一个数d, 使得这个数变成 dsiddsid的形式 ...
- ccpc杭州站 赛后总结
Ccpc杭州站赛后总结 2017年11月4号五号,我参加了ccpc杭州站的比赛,我的队友是聂少飞和王艳,在4号一点半,举行了比赛开幕式,听着教练代表的发言,听着参赛选手代表的发言,听着志愿者的发言,都 ...
- 2018 CCPC 桂林站(upc复现赛)补题
2018 CCPC 桂林站(upc复现赛)补题 G.Greatest Common Divisor(思维) 求相邻数的差值的gcd,对gcd分解素因子,对所有的素因子做一次遍历,找出最小答案. 几个样 ...
- 2021 CCPC 威海站 VP记录(题解)
2021 CCPC 威海站 VP记录(题解) 题目顺序为vp时开题顺序: A - Goodbye, Ziyin! 签到,连边数小于等于2的可以作为二叉树根,若有大于4的直接输出0. code: voi ...
- HDU 6240 Server(2017 CCPC哈尔滨站 K题,01分数规划 + 树状数组优化DP)
题目链接 2017 CCPC Harbin Problem K 题意 给定若干物品,每个物品可以覆盖一个区间.现在要覆盖区间$[1, t]$. 求选出来的物品的$\frac{∑a_{i}}{∑b_ ...
- 2017 CCPC 哈尔滨站 题解
题目链接 2017 CCPC Harbin Problem A Problem B Problem D Problem F Problem L 考虑二分答案. 设当前待验证的答案为x 我们可以把第二 ...
- 2016 CCPC 杭州站 小结
5题倒数第一,铜……(我就知道我们很稳!!!哼!! 这一次心态完全爆炸 开场我就没有按照平时的顺序读题 然后zr的A题wa 我F题T xl说B是一个最小生成树,又说是最小树形图,不会写 K题完全没思路 ...
随机推荐
- HDU2825 Wireless Password —— AC自动机 + 状压DP
题目链接:https://vjudge.net/problem/HDU-2825 Wireless Password Time Limit: 2000/1000 MS (Java/Others) ...
- ActiveMQ持久化机制
用户注册成功后发短信提醒 同步http 异步mq JMS中两种通讯模式: 发布订阅 一对多 topic 去过消费者集群的话 都会消费 消息队列 点对点 queue 去过消费者集群的话 ...
- 我的.emacs文件,用于C/C++及shell编程。
1. [代码]我的.emacs文件,用于C/C++及shell编程.;;我的配置;;1.基本配置;;外观配置***************;;禁用启动画面(setq inhibit-startup-m ...
- 蓝色科技AE宣传片头光晕视频
蓝色科技AE宣传片头光晕视频素材,蓝色AE炫光素材,科技AE片头,精美,AE特效,绚丽,AE模板,视频素材,动画. 地址:http://www.huiyi8.com/xuanguang/ae/
- 树莓派与 Python —— GPIO
首先来直观地认识树莓派提供的 40 个引脚(GPIO,general purpose i/o,接收外界输入,并向外界提供运算处理后的输出): 1. 安装 从远程库(repositories)中下载安装 ...
- ACM学习历程—FZU 2140 Forever 0.5(计算几何 && 构造)
Description Given an integer N, your task is to judge whether there exist N points in the plane su ...
- css 跳转电脑分辨率
因为我们经常在项目中要适配各种屏幕,为了方便前端的开发和测试.我们可以直接把电脑的分辨率调整到需要适配的最小的分辨率,其实还有一种更直接粗暴的方法.直接按F12打开控制台,在收拉浏览器就能看到目前的分 ...
- Linq 查询多张表,关系表
项目中遇到一个问题, 有4张表, 然后相互之间有3张关系表关联, 一共七张表. 想要从顶层表查询最底层表的记录,不能写7层嵌套. 用Linq实现特别简单, 表:User,Role,Module,Fu ...
- 物联网项目开发必读 深度分析MQTT协议优缺点
物联网并不仅仅是一种网络,而是一个新的生态环境,它描述的本质是越来越多的使用物品通过网络连接在一起并可使用单个或者多个的终端设备对它们进行各种控制和使用—当然,工业上的物联网通常连接到的石鼓传感器或者 ...
- POJ2553( 有向图缩点)
The Bottom of a Graph Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 9779 Accepted: ...