A Good Set

分析:水题,选奇数即可

 #include "iostream"
#include "cstdio"
#include "cstring"
#include "cmath"
using namespace std;
//const int maxn=110;
int T;
int n;
int main()
{
cin>>T;
while(T--)
{
cin>>n;
for(int i=;i<n;i++){
cout<<*i+<<" ";
}
cout<<endl;
}
}

Xenny and Coin Rankings

分析:水题,注意每条对角线上的rank从上到下依次增大

 #include "iostream"
#include "cstdio"
#include "cmath"
using namespace std;
int T;
long long u,v;
int main()
{
cin>>T;
while(T--){
cin>>u>>v;
long long ans=(+u+v)*(u+v)/+u+;
cout<<ans<<endl;
}
}

Chef and the Feast

分析:不错的一题,对于凡事正数的一定要加入集合,对于负数,我们设cnt表示解集里面的数字数量,val表示当时的和,b表示一个要判断是否要加进来的数,当(cnt+1)*(val+b)-cnt*val-b>0的时候,就可以加进来了,化简一下也就是cnt*b+val>0。对了,别忘了排序

 #include "iostream"
#include "cstdio"
#include "cstring"
#include "string"
#include "algorithm"
#include "vector"
using namespace std;
const int maxn=1e5+;
long long a[maxn];
int T,n;
bool cmp(long long x,long long y){
return x>y;
}
int main()
{
cin>>T;
while(T--){
cin>>n;
for(int i=;i<n;i++)
cin>>a[i];
sort(a,a+n,cmp);
int cnt=;
long long sum=,val=;
int flag=;
for(int i=;i<n;i++){
if(cnt*a[i]+val>=&&!flag){
cnt++;
val+=a[i];
sum=val*cnt;
}else{
sum+=a[i];
flag=;
}
}
cout<<sum<<endl;
}
}

June Challenge 2017的更多相关文章

  1. CodeChef June Challenge 2017

    好气啊,本来以为比赛时间还有很多,结果回家养病两天回到学校怎么比赛就结束了(雾),大约是小高考弄错了时间? 挑3道有意思的写写题解吧. Cloning 题目大意:给一个序列,每次询问两个等长区间,问区 ...

  2. 【AtCoder】Mujin Programming Challenge 2017

    Mujin Programming Challenge 2017 A - Robot Racing 如果每个数都是一个一个间隔开的,那么答案是\(n!\) 考虑把一个数挪到1,第二个数挪到3,以此类推 ...

  3. June 29th 2017 Week 26th Thursday

    Hope for the best, but prepare for the worst. 做最好的期望,做最坏的打算. Always remember that quotes about being ...

  4. June 15th 2017 Week 24th Thursday

    Whatever is worth doing is worth doing well. 任何值得做的,就把它做好. Whatever is worth doing is worth doing we ...

  5. June 04th 2017 Week 23rd Sunday

    It is not the mountain we conquer but outselves. 我们要征服的不是高山,而是我们自己. After days of hard working, I sl ...

  6. June 01st 2017 Week 22nd Thursday

    Do what you say, say what you do. 做你说过的,说你能做的. Do what I have said, live up to my promise, answer th ...

  7. 阶段性总结(2017 June 10 - 2017 July 10)

    综述 我在全面剖析了自身的特质以后,针对于工程技术领域的经验丰富优势.科学研究领域的理论薄弱劣势.我制定了全面夯实科学研究理论基础的学习计划.全面提高效率抓大放小的精力分配原则. 执行成果 线性代数( ...

  8. [codechef July Challenge 2017] Calculator

    CALC: 计算器题目描述大厨有一个计算器,计算器上有两个屏幕和两个按钮.初始时每个屏幕上显示的都是 0.每按一次第一个按钮,就会让第一个屏幕上显示的数字加 1,同时消耗 1 单位的能量.每按一次第二 ...

  9. [codechef July Challenge 2017] Chef and Sign Sequences

    CHEFSIGN: 大厨与符号序列题目描述大厨昨天捡到了一个奇怪的字符串 s,这是一个仅包含‘<’.‘=’和‘>’三种比较符号的字符串.记字符串长度为 N,大厨想要在字符串的开头.结尾,和 ...

随机推荐

  1. [JSOI2016]反质数序列

    我竟然半个小时切了一道JSOI2016,,,,不敢相信. 首先可以发现,如果N个数中1出现的次数<=1的话,我们按不能在一个集合连无向边的话,连出的一定是一个二分图. 接下来我来证明一下: 因为 ...

  2. [vxlan] 二 什么是VXLAN

    VXLAN是一种mac in UDP的技术.简单讲就是传统的二层帧被封装到了UDP的package中.通过UDP的IP网络发送到目的地然后再解封装. VXLAN 跟VLAN对比,最重要的一个概念就是V ...

  3. ASP.NET Core 如何记录每次响应的Response信息 - sky 胡萝卜星星 - CSDN博客

    原文:ASP.NET Core 如何记录每次响应的Response信息 - sky 胡萝卜星星 - CSDN博客 上一篇文章中我们已经成功的记录了Request部分的信息,现在我们来看下如何记录Res ...

  4. flask使用debug模式时,存在错误时,会占用设备内存直至服务重启才释放;debug模式会开启一个守护进程(daemon process)

    函数调用顺序flask的app.py的run-->werkzeug的serving.py的run_simple-->调用werkzeug的debug的__init__.py里的类Debug ...

  5. CentOS 6.x安装多GCC版本号,cmake的安装与使用

    操作系统:CentOS release 6.5 (Final) 当前gcc版本号:build=x86_64-redhat-linux                           Thread ...

  6. BUPT复试专题—统计时间间隔(2013计院)

    题目描述 给出两个时间(24小时制),求第一个时间至少要经过多久才能到达第二个时间.给出的时间一定满足的形式,其中x和y分别代表小时和分钟.0≤x<24,0≤y<60. 输入格式 第一行为 ...

  7. Angularjs: call other scope which in iframe

    Angularjs: call other scope which in iframe -------------------------------------------------------- ...

  8. Unity ----- 对象池GameObjectPool

    孙广东 2014.6.28 非常早之前看到的外国文章,认为不错,分享一下. 对象池在AssetStore中也是有非常多插件的,可是有些重了.自己写一个轻量的岂不是非常好. 当你须要创建大量某种类型对象 ...

  9. 简谈Java的join()方法(转)

    join()是Thread类的一个方法.根据jdk文档的定义: public final void join()throws InterruptedException: Waits for this ...

  10. centos下的hadoop服务器的配置

    是我安装CentOS服务器的过程,记录下来,与大家一起分享. 安装操作系统 CentOS 6.2 ,CentOS-6.2-i386-bin-DVD1.iso(32位) ,CentOS-6.2-x86_ ...