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. Struts2的验证框架简单吗?

    Struts2验证框架是基于Struts拦截器开发的,具有良好的扩展性:一般的验证都可以支持.现在我们以一个注册验证的例子进行总结: 新建一个model,User: public class User ...

  2. T2038 香甜的黄油 codevs

    http://codevs.cn/problem/2038/ 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 钻石 Diamond   题目描述 Description 农夫John ...

  3. CS Academy #32 G

    题意: 分析: 考虑如何求方案数 dp[i][j]表示i个数字的和为j的方案数,这是个经典问题,转移有两种,一个是填一个数字1,一个是整体加1 然后这个问题并不是求方案数,而是求对应的权值和 我们很容 ...

  4. discuz搬家

    1.需要重命名forumdata下面的cache和templates文件夹 2.如果数据库账户名和密码有改动过,需要修改config.inc.php 3.保证uc_server的链接正确!

  5. IE浏览器打不开解决的方法

    windows 7和windows 8上的IE浏览器打不开.非常可能是权限问题,解决的方法: 点击"開始"-"执行",输入"regedit" ...

  6. SQL获取事件探查器保存的跟踪文件

    fn_trace_gettable (Transact-SQL) 以表格格式返回一或多个跟踪文件的内容. Transact-SQL 语法约定 语法 fn_trace_gettable ( filena ...

  7. 【转载】分布式系统理论基础 - 一致性、2PC和3PC

    引言 狭义的分布式系统指由网络连接的计算机系统,每个节点独立地承担计算或存储任务,节点间通过网络协同工作.广义的分布式系统是一个相对的概念,正如Leslie Lamport所说[1]: What is ...

  8. oracle SQL语句(转)

    Oracle数据库语句大全 ORACLE支持五种类型的完整性约束 NOT NULL (非空)--防止NULL值进入指定的列,在单列基础上定义,默认情况下,ORACLE允许在任何列中有NULL值. CH ...

  9. Dell服务器相关操作

    1. Raid相关: # 删除已有的Raid配置 MegaCli64 -CfgLdDel -LALL -aALL # 获取设备ID和槽号 MegaCli64 -PDList -aALL|egrep ' ...

  10. iOS UILabel换行同时修改字体大小颜色

    UIButton *onlyPriceBtn = [UIButton buttonWithType:UIButtonTypeCustom]; onlyPriceBtn.layer.borderColo ...