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. linux中fflush函数和printf函数 【转】

    本文转载自:http://blog.chinaunix.net/uid-30058258-id-5029847.html printf是一个行缓冲函数printf函数是标准函数,最终会调用到系统调用函 ...

  2. 在WAMPSERVER下增加多版本的PHP(PHP5.3,PHP5.4,PHP5.5 ,PHP5.6)支持。

    本人预装了一个wamp的集成环境(Apache 2.4.9 + PHP 5.5.12 + mysql 5.6.17),今天在wamp环境下 添加PHP多版本 (PHP 5.5.30).中间两个过程,1 ...

  3. 经典数学问题<手电过河问题>的动态解法--问题规模扩展至任意大小

    非常有趣的一件事是今天在TopCoder的1000分题里面发现了这道经典数学问题. Notes           -                   In an optimal solution ...

  4. java入门的语法学习

    用java语言写了一个求两个数最大公约数的程序: import java.io.*; import java.util.*; import java.math.*; public class Main ...

  5. sping junit test

    @ContextConfiguration(locations="classpath:spring.xml")public class BaseTest extends Abstr ...

  6. 算法(Algorithms)第4版 练习 1.3.13

    (a) 0 1 2 3 4 5 6 7 8 9 (b) 4 6 8 7 5 3 2 9 0 1 (c) 2 5 6 7 4 8 9 3 1 0 (d) 4 3 2 1 0 5 6 7 8 9 答案:b ...

  7. Contiki-Timer 概述

    Contiki有一个clock模块和一系列timer模块:timer,stimer,ctimer,etimer,和rtimer. 一.clock模块 clock模块提供一些处理系统时间的函数,还有一些 ...

  8. latex 技巧汇总

    最近打算详细的学习一下latex,所以在学习的过程中遇到了一些问题.随时出问题,随时记录更新. 我是萌萌的Latex, x_0. 再写具体的技巧之前,先说一个关于打公式的小技巧.有时候你不知道怎么设置 ...

  9. jstl <c:url>标签

    标签作用是将一个URL地址格式化为一个字符串,并且保存在一个变量当中.它具有URL自动重写功能.value指定的URL可以是当前工程的一个URL地址,也可以是其他web工程的URL.但是这时需要con ...

  10. CATTI二级口译训练

    Vice chancellor, faculty members and dear students, It is my great pleasure and privilege to visit C ...