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. vue之组件理解(一)

    组件是可复用的 Vue 实例,所以它们与 new Vue 接收相同的选项,例如 data.computed.watch.methods 以及生命周期钩子等.仅有的例外是像 el 这样根实例特有的选项. ...

  2. luogu P3865 【模板】ST表

    题目背景 这是一道ST表经典题——静态区间最大值 请注意最大数据时限只有0.8s,数据强度不低,请务必保证你的每次查询复杂度为 O(1)O(1) 题目描述 给定一个长度为 NN 的数列,和 MM 次询 ...

  3. CodeWar----求正整数二进制表示中1的个数

    Codewars Write a function that takes an integer as input, and returns the number of bits that are eq ...

  4. 【转】LINUX 手动建立SWAP文件及删除

    如何在红帽 企业版Linux系统中添加swap文件? 解决方法: 1. 确定swap文件的大小,单位为M.将该值乘以1024得到块大小.例如,64MB的swap文件的块大小是65536. 2. 在ro ...

  5. Android 支付宝快捷支付集成及ALI64错误的有效解决

    支付宝开放平台採用了RSA安全签名机制,开发人员能够通过支付宝公钥验证消息来源.同一时候可使用自己的私钥对信息进行加密. RSA算法及数字签名机制是支付宝开放平台与开发人员网关安全通信的基础.若开发人 ...

  6. HDU oj 开门人与关门人

    题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1234 #include<stdio.h> #include<string.h> ...

  7. 函数柯里化 curry

    一.函数柯里化的特性: (1)参数复用 $.ajax // 示例一 function ajax(type,url,data) { var xhr = new XMLHttpRequest(); xhr ...

  8. free命令具体解释——Linux性能分析

    一.使用格式 语法格式:free [-b | -k | -m] [-o] [-s delay ] [-t] [-l] [-V] [-b | -k | -m] :选择数据的单位-b字节.-k千字节.-m ...

  9. C++经典面试题解析

    1. // BlankTest.cpp : 定义控制台应用程序的入口点. //题目:将一个文件中的一组整数排序后输出到另一个文件中 #include "stdafx.h" #inc ...

  10. Jenkins系列之-—07 集成JIRA

    一.Jenkins Jira插件安装&配置 1. 安装插件,主要安装如下插件: Jira Issue Updater 该插件用于更新JIRA ISSUES 的工作流状态或增加备注 JIRA p ...