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.
![](http://acm.hdu.edu.cn/data/images/C762-1009-1.jpg)
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代马 ┣┓┆ ┆ ┃ ┏┛┆ ┆ ┗┓┓┏━┳┓┏┛ ┆ ┆ ┃┫┫ ┃┫┫ ┆ ┆ ┗┻┛ ┗┻┛ ┆ ************************************************ */
相关文章推荐
- 2017 Multi-University Training Contest - Team 4:1009&hdu6075、Questionnaire
- 2017 Multi-University Training Contest - Team 1 1009 I Curse Myself 【思维 + 仙人掌图】
- 2017 Multi-University Training Contest - Team 2 1009 HDU 6053 TrickGCD(分段 容斥)
- HDU 2017 Multi-University Training Contest - Team 4 1009 1011
- 2017 Multi-University Training Contest - Team 4 Questionnaire
- 2017 Multi-University Training Contest - Team 6:1003&hdu6098、Inversion
- 2017 Multi-University Training Contest - Team 7:1011. Kolakoski(模拟)
- 2017 Multi-University Training Contest - Team 7 hard challenge
- 2017 Multi-University Training Contest - Team 7 Just do it
- 2017 Multi-University Training Contest - Team 6 HDU 6105 Gameia(博弈)
- 2017 Multi-University Training Contest - Team 8
- 2017 Multi-University Training Contest - Team 7 待补
- 2017 Multi-University Training Contest - Team 9 Numbers (实力乱搞)
- 2017 Multi-University Training Contest - Team 9 1001&&HDU 6161 Big binary tree【树形dp+hash】
- 2017 Multi-University Training Contest - Team 1 1006 Function(置换群)
- hdoj 6063(2017 Multi-University Training Contest - Team 3) RXD and math
- 【2017 Multi-University Training Contest - Team 7】Just do it
- 【2017 Multi-University Training Contest - Team 1 1002】Balala Power!
- HDU-6038 Function - 2017 Multi-University Training Contest - Team 1(构造置换或强连通分量)
- hdu 6034 Balala Power!(贪心)( 2017 Multi-University Training Contest - Team 1 )(无耻之sort)