您的位置:首页 > 产品设计 > UI/UE

2017 Multi-University Training Contest - Team 4 1009 Questionnaire

2017-08-04 15:22 429 查看

Questionnaire

[align=center]Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 365    Accepted Submission(s): 284
[/align]

[align=left]Problem Description[/align]

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 integerai
to represent his opinion. When finished, the leader will choose a pair of positive intergesm(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.
 

[align=left]Input[/align]

The first line of the input contains an integerT(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.
 

[align=left]Output[/align]

For each test case, print a single line containing two integersm
and k,
if there are multiple solutions, print any of them.
 

[align=left]Sample Input[/align]

1
6
23 3 18 8 13 9

 

[align=left]Sample Output[/align]

5 3

 

///AC代码
/* ***********************************************
┆  ┏┓   ┏┓ ┆
┆┏┛┻━━━┛┻┓ ┆
┆┃       ┃ ┆
┆┃   ━   ┃ ┆
┆┃ ┳┛ ┗┳ ┃ ┆
┆┃       ┃ ┆
┆┃   ┻   ┃ ┆
┆┗━┓ 马 ┏━┛ ┆
┆  ┃ 勒 ┃  ┆      
┆  ┃ 戈 ┗━━━┓ ┆
┆  ┃ 壁     ┣┓┆
┆  ┃ 的草泥马  ┏┛┆
┆  ┗┓┓┏━┳┓┏┛ ┆
┆   ┃┫┫ ┃┫┫ ┆
┆   ┗┻┛ ┗┻┛ ┆
************************************************ */
#include <iostream>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <cstdio>
#include <bitset>
#include <string>
#include <vector>
#include <iomanip>
#include <cstring>
#include <algorithm>
#include <functional>
#define PI acos(-1)
#define eps 1e-8
#define inf 0x3f3f3f3f
#define debug(x) cout<<"---"<<x<<"---"<<endl
typedef long long ll;
using namespace std;

int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int n;
scanf("%d", &n);
int aa = 0, bb = 0, xx;
for (int i = 0; i < n; i++)
{
scanf("%d", &xx);
if (xx % 2 == 0)
{
aa++;
}
else  if (xx % 2 == 1)
{
bb++;
}
}
if (aa >= bb)
{
printf("2 0\n");
}
else if (aa < bb)
{
printf("2 1\n");
}
}
return 0;
}

/************************************************
┆  ┏┓   ┏┓ ┆
┆┏┛┻━━━┛┻┓ ┆
┆┃       ┃ ┆
┆┃   ━   ┃ ┆
┆┃ ┳┛ ┗┳ ┃ ┆
┆┃       ┃ ┆
┆┃   ┻   ┃ ┆
┆┗━┓    ┏━┛ ┆
┆  ┃    ┃  ┆      
┆  ┃    ┗━━━┓ ┆
┆  ┃  AC代马   ┣┓┆
┆  ┃           ┏┛┆
┆  ┗┓┓┏━┳┓┏┛ ┆
┆   ┃┫┫ ┃┫┫ ┆
┆   ┗┻┛ ┗┻┛ ┆
************************************************ */
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  acm hdu 多校训练
相关文章推荐