Problem Description
In order to get better results in official ACM/ICPC contests, the team leader comes up with a questionnaire. He asked everyone in the team whether to have more training.


Picture from Wikimedia Commons

Obviously many people don't want more training, so the clever leader didn't write down their words such as ''Yes'' or ''No''. Instead, he let everyone choose a positive integer ai to represent his opinion. When finished, the leader will choose a pair of positive interges m(m>1) and k(0≤k<m), and regard those people whose number is exactly k modulo m as ''Yes'', while others as ''No''. If the number of ''Yes'' is not less than ''No'', the leader can have chance to offer more training.

Please help the team leader to find such pair of m and k.

 
Input
The first line of the input contains an integer T(1≤T≤15), denoting the number of test cases.

In each test case, there is an integer n(3≤n≤100000) in the first line, denoting the number of people in the ACM/ICPC team.

In the next line, there are n distinct integers a1,a2,...,an(1≤ai≤109), denoting the number that each person chosen.

 
Output
For each test case, print a single line containing two integers m and k, if there are multiple solutions, print any of them.
 
Sample Input
1
6
23 3 18 8 13 9
 
Sample Output
5
3
 
题意:给出n个数a[i],要求你回答任意一组m,k,使得a[i]%m==k的个数大于等于剩余个数
题解:使m=2,计算序列中奇偶个数并比较即可
 
 #include <iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<cmath>
#include<cstring>
using namespace std; int main()
{
int T,n,num;
int a,b;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
a=;b=;
while(n--)
{
scanf("%d",&num);
if(num%==)
a++;
else
b++;
}
if(a>=b)
printf("%d %d\n",,);
else
printf("%d %d\n",,);
}
return ;
}

HDU 6075 Questionnaire 17多校4 水题的更多相关文章

  1. HDU 5832 A water problem(某水题)

    p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...

  2. hdu 2393:Higher Math(计算几何,水题)

    Higher Math Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  3. <hdu - 3999> The order of a Tree 水题 之 二叉搜索的数的先序输出

    这里是杭电hdu上的链接:http://acm.hdu.edu.cn/showproblem.php?pid=3999  Problem Description: As we know,the sha ...

  4. HDOJ/HDU 1256 画8(绞下思维~水题)

    Problem Description 谁画8画的好,画的快,今后就发的快,学业发达,事业发达,祝大家发,发,发. Input 输入的第一行为一个整数N,表示后面有N组数据. 每组数据中有一个字符和一 ...

  5. hdu 1164:Eddy's research I(水题,数学题,筛法)

    Eddy's research I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  6. HDU ACM 1073 Online Judge -&gt;字符串水题

    分析:水题. #include<iostream> using namespace std; #define N 5050 char a[N],b[N],tmp[N]; void Read ...

  7. hdu 1754 I Hate It(线段树水题)

    >>点击进入原题测试<< 思路:线段树水题,可以手敲 #include<string> #include<iostream> #include<a ...

  8. HDU 2086 A1 = ? (找规律推导公式 + 水题)(Java版)

    Equations 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2086 ——每天在线,欢迎留言谈论. 题目大意: 有如下方程:Ai = (Ai-1 ...

  9. HDU 1029 Ignatius and the Princess IV --- 水题

    HDU 1029 题目大意:给定数字n(n <= 999999 且n为奇数 )以及n个数,找出至少出现(n+1)/2次的数 解题思路:n个数遍历过去,可以用一个map(也可以用数组)记录每个数出 ...

随机推荐

  1. 集成学习一: Bagging

    目录 偏倚与方差 Bagging 自助采样 投票 随机森林 参考文献: ''团结就是力量'' 对问题进行建模时, 算法无论如何优化都无法达到我们的要求,又或者精准算法的实现或调优成本太大, 这时,我们 ...

  2. SpringBoot系列之jar包转war包

    1.修改pom,将打包方式改为war包 2.dependencides中配置外部tomcat <!--因配置外部TOMCAT 而配置--> <dependency> <g ...

  3. [CodeForces - 197F] F - Opening Portals

    F - Opening Portals Pavel plays a famous computer game. A player is responsible for a whole country ...

  4. vue 给 图片添加一个默认图片

    <img v-bind:src="userData.photo" :onerror="logo" class="img-box4"&g ...

  5. CentOS下安装MYSQL8.X并设置忽略大小写

    安装 在官网上下载:mysql80-community-release-el7-2.noarch.rpm.安装方式与5.7基本相同.详细安装过程见:CentOS下安装mysql5.7和mysql8.x ...

  6. puppeteer 爬虫 pdf 截图 自动化

    puppeteer简介 puppeteer 翻译是操纵木偶的人,利用这个工具,我们能做一个操纵页面的人.puppeteer是一个nodejs的库,支持调用Chrome的API来操纵Web,相比较Sel ...

  7. nodejs安装 淘宝镜像

    1◆ nodejs下载 2◆ 安装 3◆ 测试   4◆ 淘宝镜像 npm install -g cnpm --registry=https://registry.npm.taobao.org   5 ...

  8. suffix word ality ally an ancy ance an aneity out ~1

    1● ality 状态,性质   2● ally al+ly ~地   3● an ~地方 ,~人       1★ ance=ancy 性质 ,状态   2★ant ~人,~剂,~的   3★ an ...

  9. json模块&xml

    json模块将数据修改成字符串,方便其他语言进行识别. 只认双引号,不认单引号.使用json.dumps的操作步骤 先将单引号修改成单引号 将变量使用单引号引起来 将数据类型编程json字符串 jso ...

  10. spring boot 打包可以运行,但是执行main方法不能运行

    报错信息如下 2017-10-23 15:16:09.750 ERROR 7664 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReport ...