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吉林站的更多相关文章

  1. 2018 CCPC 吉林站 H Lovers

    2018 CCPC 吉林站 H Lovers 传送门:https://www.spoj.com/problems/LIS2/en/ 题意: q次操作 1.将第l~r个数的左边和和右边都加上一个数d, ...

  2. 2018年9月22日CCPC吉林站参赛总结

    发现思维题是硬伤,代码能力是硬伤,对知识点的理解不深刻是硬伤 接下来要做的就是 1.熟悉每一个知识点,把每一个知识点和实现它的代码联系在一起学习 2.多见题,看看他们是怎么考察这些知识点的,等比赛的时 ...

  3. 2018 CCPC 吉林站 H Lovers || HDU 6562 (线段树哦)

    http://acm.hdu.edu.cn/showproblem.php?pid=6562 题意: q次操作 1.将第l~r个数的左边和和右边都加上一个数d, 使得这个数变成 dsiddsid的形式 ...

  4. ccpc杭州站 赛后总结

    Ccpc杭州站赛后总结 2017年11月4号五号,我参加了ccpc杭州站的比赛,我的队友是聂少飞和王艳,在4号一点半,举行了比赛开幕式,听着教练代表的发言,听着参赛选手代表的发言,听着志愿者的发言,都 ...

  5. 2018 CCPC 桂林站(upc复现赛)补题

    2018 CCPC 桂林站(upc复现赛)补题 G.Greatest Common Divisor(思维) 求相邻数的差值的gcd,对gcd分解素因子,对所有的素因子做一次遍历,找出最小答案. 几个样 ...

  6. 2021 CCPC 威海站 VP记录(题解)

    2021 CCPC 威海站 VP记录(题解) 题目顺序为vp时开题顺序: A - Goodbye, Ziyin! 签到,连边数小于等于2的可以作为二叉树根,若有大于4的直接输出0. code: voi ...

  7. HDU 6240 Server(2017 CCPC哈尔滨站 K题,01分数规划 + 树状数组优化DP)

    题目链接  2017 CCPC Harbin Problem K 题意  给定若干物品,每个物品可以覆盖一个区间.现在要覆盖区间$[1, t]$. 求选出来的物品的$\frac{∑a_{i}}{∑b_ ...

  8. 2017 CCPC 哈尔滨站 题解

    题目链接  2017 CCPC Harbin Problem A Problem B Problem D Problem F Problem L 考虑二分答案. 设当前待验证的答案为x 我们可以把第二 ...

  9. 2016 CCPC 杭州站 小结

    5题倒数第一,铜……(我就知道我们很稳!!!哼!! 这一次心态完全爆炸 开场我就没有按照平时的顺序读题 然后zr的A题wa 我F题T xl说B是一个最小生成树,又说是最小树形图,不会写 K题完全没思路 ...

随机推荐

  1. C语言“快速排序”函数写法

    代码是:C语言中快速排的写法,要加入头文件   <stdlib.h> qsort(数组名, 长度, 数据类型大小,比较算子 ): #include <stdio.h> #inc ...

  2. ZOJ 3805 Machine(二叉树,递归)

    题意:一颗二叉树,求  “  宽度  ” 思路:递归,貌似这个思路是对的,先记下,但是提交时超时, 1.如果当前节点只有左孩子,那么当前宽度等于左孩子宽度 2.如果当前节点只有右孩子,那么当前宽度等于 ...

  3. 2017 google IO大会——5.17

    大家好! 每年一度的全球互联网及新型技术的盛会 Google IO,今年的大会日期和地址已经公布了:大会将在5月17至19日在谷歌公司总部边上的会场,美国加州 Mountain View的 Shore ...

  4. android自定义控件(二) 入门,继承View

    转载请注明地址:http://blog.csdn.net/ethan_xue/article/details/7313788 ps: 可根据apidemo里LableView,list4,list6学 ...

  5. 【LeetCode】Reverse Words in a String 反转字符串中的单词

    一年没有管理博客园了,说来实在惭愧.. 最近开始刷LeetCode,之前没刷过,说来也实在惭愧... 刚开始按 AC Rates 从简单到难刷,觉得略无聊,就决定按 Add Date 刷,以后也可能看 ...

  6. BZOJ-3940:Censoring(AC自动机裸题)

    Farmer John has purchased a subscription to Good Hooveskeeping magazine for his cows, so they have p ...

  7. 【LeetCode】051. N-Queens

    题目: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two que ...

  8. Day04:函数参数、对象、嵌套、闭包函数和装饰器

    上节课复习:    1.什么是函数        函数就是具备某一功能的工具    2.为何用函数        1.程序的组织结构和可读性        2.减少代码冗余        3.扩展性强 ...

  9. IOS深入学习

    iOS超全开源框架.项目和学习资料汇总(1)UI篇 iOS超全开源框架.项目和学习资料汇总(2)动画篇 iOS超全开源框架.项目和学习资料汇总(3)网络和Model篇 数据库 FMDB – sqlit ...

  10. SQLServer中连接个数及超时问题

    超时时间已到.超时时间已到,但是尚未从池中获取连接.出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小. 解决办法1.在代码里面,把未关闭的连接关闭2.扩大共享池,方法如下:解决方法可以是 ...