链接:http://codeforces.com/gym/101116

题意:选六个数,必须出现次数最多,且数字最小,如果出现7优先加入7

解法:排序,出现7优先加入7,最后再将6个数排序

#include<bits/stdc++.h>
using namespace std;
struct P
{
int num,pos,M;
}He[1000];
bool cmd(P a,P b)
{
if(a.pos==b.pos)
{
return a.M<b.M;
}
else
{
return a.pos>b.pos;
}
}
int main()
{
int t,n;
cin>>t;
while(t--)
{
cin>>n;
for(int i=0; i<51; i++)
{
if(i!=7)
{
He[i].num=i;
He[i].pos=0;
He[i].M=i;
}
else
{
He[i].num=i;
He[i].pos=0;
He[i].M=0;
}
}
while(n--)
{
int a;
for(int i=0;i<6;i++)
{
cin>>a;
He[a].pos++;
}
}
int num[10];
sort(He,He+51,cmd);
for(int i=0;i<6;i++)
{
num[i]=He[i].num;
}
sort(num,num+6);
for(int i=0;i<6;i++)
{
cout<<num[i]<<" ";
}
cout<<endl;
}
return 0;
}

  

2016-2017 CT S03E05: Codeforces Trainings Season 3 Episode 5 (2016 Stanford Local Programming Contest, Extended) I的更多相关文章

  1. 2016-2017 CT S03E05: Codeforces Trainings Season 3 Episode 5 (2016 Stanford Local Programming Contest, Extended) E

    链接:http://codeforces.com/gym/101116 学弟写的,以后再补 #include <iostream> #include <algorithm> # ...

  2. 2016-2017 CT S03E05: Codeforces Trainings Season 3 Episode 5 (2016 Stanford Local Programming Contest, Extended) J

    链接:http://codeforces.com/gym/101116 题意:给出n个点,要求一个矩形框将(n/2)+1个点框住,要面积最小 解法:先根据x轴选出i->j之间的点,中间的点(包括 ...

  3. 2016-2017 CT S03E05: Codeforces Trainings Season 3 Episode 5 (2016 Stanford Local Programming Contest, Extended) B

    链接:http://codeforces.com/gym/101116 学弟做的,以后再补 #include <iostream> #include <stdio.h> #in ...

  4. 2016-2017 CT S03E06: Codeforces Trainings Season 3 Episode 6(8/13)

    2016-2017 CT S03E06: Codeforces Trainings Season 3 Episode 6 比赛连接: http://codeforces.com/gym/101124/ ...

  5. 2016-2017 CT S03E07: Codeforces Trainings Season 3 Episode 7 - HackerEarth Problems Compilation

    B: 思路: 暴力,每两个判断一下; C: 思路: 容斥定理,先枚举脖子下面那个点和那个不可描述的点,算出所有的方案数,这里面有多的腿当成了脖子或者胳膊的,然后就再枚举这种情况把这些减去,又减多了; ...

  6. 2016-2017 CT S03E02: Codeforces Trainings Season 3 Episode 2

    A HHPaint B Square Root C Interesting Places D Road to Home E Ant and apples F Square G Pair H The F ...

  7. 2016-2017 CT S03E06: Codeforces Trainings Season 3 Episode 6 The Baguette Master

    比赛看不懂 之后不确定题意去瞄了题解,需要分类讨论?囧 之后按照队友已经ac的题意 就是求外面一圈周长,直接可以求得 #include<bits/stdc++.h> using names ...

  8. 2016-2017 CT S03E07: Codeforces Trainings Season 3 Episode 7

    B. Pen Pineapple Apple Pen Solved. 题意:将一个序列合并成一个数. 思路:分类讨论一下, 水. #include<bits/stdc++.h> using ...

  9. 2014-2015 Codeforces Trainings Season 2 Episode 7 G Gophers --线段树

    题意: 有n个地鼠,m个CD碟,每个CD碟有一个影响范围,范围内的地鼠都会被吵到,每次有一个操作就是移动CD碟,然后求每次被影响的地鼠有多少只. 解法: 线段树做.我们只关注地鼠有没有被吵到就可以了, ...

随机推荐

  1. EXTJS 5 开发环境搭建

    WEBstrom eclipse下载: http://www.eclipse.org/downloads/ spket 下载: 安装方式: http://wangke0611.iteye.com/bl ...

  2. php扩展的基本安装

    phpize ./config --with-php-config=.. make&make install php.ini

  3. spark-submit常用参数

    yarn模式默认启动2个executor,无论你有多少的worker节点 standalone模式每个worker一个executor,无法修改executor的数量 partition是RDD中的一 ...

  4. java文件下载 rest

    /** * 返回文件二进制 * */ @GET @Path("/excel") @Produces("application/vnd.ms-excel; charset= ...

  5. XStream xml转java对象

    1:引入jar qn <dependency> <groupId>xstream</groupId> <artifactId>xstream</a ...

  6. DDR3简介(一)

    JEDEC成立于1958年,作为电子产业协会联盟(EIA)的一部分,为新兴的半导体产业制定标准.主要功能包括术语定义,产品特征描述,测试方法,固态存储器,DRAM,闪存卡及射频识别标签等的确定与标准化 ...

  7. PAT乙级 1031. 查验身份证(15) 标志要清零!!!!!!!!!

    1031. 查验身份证(15) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 一个合法的身份证号码由17位地区. ...

  8. [Ubuntu] Ubuntu搭建VPN服务器pptpd

    在 Ubuntu 上搭建 VPN 服务器的方法非常多,比较著名的有 PPTP, L2TP/IPSec 和 OpenVPN. 这三种方式中后两者的安全性比较好,但配置较麻烦.其中 OpenVPN 在 W ...

  9. 【fedora】强制解除yum锁定

    运行yum makecache时出现yum update时候出现Another app is currently holding the yum lock解决方法yum被锁定了. 可以通过执行 rm ...

  10. 各种类型的Writable(Text、ByteWritable、NullWritable、ObjectWritable、GenericWritable、ArrayWritable、MapWritable、SortedMapWritable)转

    java原生类型 除char类型以外,所有的原生类型都有对应的Writable类,并且通过get和set方法可以他们的值. IntWritable和LongWritable还有对应的变长VIntWri ...