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. GitHub学习二-将本地Git库与Github上的Git库相关联

    0 git clone 如果是从自己的github clone,一键搞定,和三步的git remote add功能一样. 1.创建本地库 新建目录,右键git bash here,输入 git ini ...

  2. 为什么要使用oath协议?

    一.如何查看用户是否登录? 通过cookie和session来查看用户是否登录. 如果cookie对应的session中保存了用户登录信息,则判定用户已登录 Jsessionid,也就是tomcat自 ...

  3. Visual Studio references中的package找不到

    1. 把solution里面所有project的.net版本设成一样的 2. ERROR: This project references NuGet package(s) that are miss ...

  4. php对于url提交数据的获取办法

    $url = Request::getUri();//获取当前的url $arr = parse_url($url); //$arr_query = convertUrlQuery($arr['que ...

  5. python运算符号

    运算符 比较运算 赋值运算 逻辑运算 成员运算

  6. C++解析六-继承

    面向对象程序设计中最重要的一个概念是继承.继承允许我们依据另一个类来定义一个类,这使得创建和维护一个应用程序变得更容易.这样做,也达到了重用代码功能和提高执行时间的效果.当创建一个类时,您不需要重新编 ...

  7. 未来Linux系统将是运维行业必备的技能之一

    关于linux,这个并不是每个人都能用或者需要用的,因为平时有很多人用电脑只是为了上上网,聊聊天,打打游戏,这个是完全不需要用linux的.关于linux,是不能用正常的大家所熟知的window来认知 ...

  8. JQuery button控制div或者section

    一.项目你需求 点击左边导航栏的某个按钮,右边内容栏显示出,相应的内容 效果如图   二.html与css.jQuery 1.div模式 <!DOCTYPE html PUBLIC " ...

  9. day23 模块02

    核能来袭--模块 2 1.nametuple() 2.os模块 3.sys模块(重点) 4.序列化 (四个函数) 5.pickle(重点) 6.json(重点中的重点) 1.nametuple() 命 ...

  10. 【转】用深度学习做crowd density estimation

    本博文主要是CVPR2016的<Single-Image Crowd Counting via Multi-Column Convolutional Neural Network>这篇文章 ...