HDU 2017 Multi-University Training Contest - Team 4 1009 1011
Questionnaire
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 422 Accepted Submission(s): 320
Special Judge
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.
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.
6
23 3 18 8 13 9
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define ios() ios::sync_with_stdio(false)
#define INF 0x3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
int x,t,n;
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
int pos=,ans=;
for(int i=;i<n;i++)
{
scanf("%d",&x);
if(x&) ans++;
else pos++;
}
puts(ans>pos?"2 1":"2 0");
}
}
Time To Get Up
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 458 Accepted Submission(s): 362
Q's clock is alarming! It's time to get up now! However, after reading
the time on the clock, Little Q lies down and starts sleeping again.
Well, he has 5 alarms, and it's just the first one, he can continue sleeping for a while.
Little
Q's clock uses a standard 7-segment LCD display for all digits, plus
two small segments for the '':'', and shows all times in a 24-hour
format. The '':'' segments are on at all times.
Your job is to help Little Q read the time shown on his clock.
In each test case, there is an 7×21 ASCII image of the clock screen.
All
digit segments are represented by two characters, and each colon
segment is represented by one character. The character ''X'' indicates a
segment that is on while ''.'' indicates anything else. See the sample
input for details.
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define ios() ios::sync_with_stdio(false)
#define INF 0x3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
char s[][];
int a[][],n;
int solve(int *a)
{
if(a[]== && a[]== && a[]== && a[]== && a[]== && a[]== && a[]==) return ;
if(a[]== && a[]== && a[]== && a[]== && a[]== && a[]== && a[]==) return ;
if(a[]== && a[]== && a[]== && a[]== && a[]== && a[]== && a[]==) return ;
if(a[]== && a[]== && a[]== && a[]== && a[]== && a[]== && a[]==) return ;
if(a[]== && a[]== && a[]== && a[]== && a[]== && a[]== && a[]==) return ;
if(a[]== && a[]== && a[]== && a[]== && a[]== && a[]== && a[]==) return ;
if(a[]== && a[]== && a[]== && a[]== && a[]== && a[]== && a[]==) return ;
if(a[]== && a[]== && a[]== && a[]== && a[]== && a[]== && a[]==) return ;
if(a[]== && a[]== && a[]== && a[]== && a[]== && a[]== && a[]==) return ;
if(a[]== && a[]== && a[]== && a[]== && a[]== && a[]== && a[]==) return ; }
int main()
{
scanf("%d",&n);
while(n--)
{
memset(a,,sizeof(a));
for(int i=;i<=;i++)
{
scanf("%s",s[i]+);
}
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
if(s[][]=='X') a[][]=;
printf("%d%d:%d%d\n",solve(a[]),solve(a[]),solve(a[]),solve(a[]));
}
return ;
}
HDU 2017 Multi-University Training Contest - Team 4 1009 1011的更多相关文章
- 2017 Multi-University Training Contest - Team 9 1005&&HDU 6165 FFF at Valentine【强联通缩点+拓扑排序】
FFF at Valentine Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- 2017 Multi-University Training Contest - Team 9 1004&&HDU 6164 Dying Light【数学+模拟】
Dying Light Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Tot ...
- 2017 Multi-University Training Contest - Team 9 1003&&HDU 6163 CSGO【计算几何】
CSGO Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Subm ...
- 2017 Multi-University Training Contest - Team 9 1002&&HDU 6162 Ch’s gift【树链部分+线段树】
Ch’s gift Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total S ...
- 2017 Multi-University Training Contest - Team 9 1001&&HDU 6161 Big binary tree【树形dp+hash】
Big binary tree Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)T ...
- 2017 Multi-University Training Contest - Team 1 1003&&HDU 6035 Colorful Tree【树形dp】
Colorful Tree Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)T ...
- 2017 Multi-University Training Contest - Team 1 1006&&HDU 6038 Function【DFS+数论】
Function Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total ...
- 2017 Multi-University Training Contest - Team 1 1002&&HDU 6034 Balala Power!【字符串,贪心+排序】
Balala Power! Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)T ...
- 2017 Multi-University Training Contest - Team 1 1011&&HDU 6043 KazaQ's Socks【规律题,数学,水】
KazaQ's Socks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)T ...
随机推荐
- jsLittle源码封装对象
window.JSLi = ((function(){ var JSLi = function(selector) { return new JSLi.fn.init(selector); }; JS ...
- 51Nod 3的幂的和(扩展欧几里德求逆元)
求:3^0 + 3^1 +...+ 3^(N) mod 1000000007 Input 输入一个数N(0 <= N <= 10^9) Output 输出:计算结果 Input示例 3 O ...
- cmder-替代cmd
之所以选择cmder,说来话长,在学习python的过程中,由于经常通过pip命令安装包,并且在学习一些包的使用例如virtualenv,教程贴都是在终端下的命令,这使我对cmd的使用频率慢慢变多了起 ...
- 今日SGU 5.25
SGU 194 题意:无源汇有上下界的最大流 收获:https://wenku.baidu.com/view/0f3b691c59eef8c75fbfb35c.html #include<bit ...
- HDU 4976 A simple greedy problem. 贪心+DP
题意: 给定n<=1000个小兵,A每次都能使小兵掉1点血,B每次能使所有小兵掉1点血,A.B轮流攻击,每次轮到A他会选择是否攻击,轮到B必须攻击.求A最多能杀死多少小兵.(当小兵血量为1时被攻 ...
- ArcGIS api for javascript——用缓存区查询地图
描述 本例展示了如何在另外一个任务里使用一个任务的结果.单击地图查看被单击的点的1公里范围内的缓存(如果需要可以修改这个默认的缓存距离).也可以看缓存区的这些点的人口普查街区信息.单击一个点查看更多的 ...
- Canvas与Paint的0基础使用
看了非常多android自己定义方面的资料,了解了非常多原理,遇到人家自己定义的东西也可以看得懂,可是.当自己去自己定义的时候.发现脑袋一片空白,所以就先从认识Canvas和Paint開始吧! Can ...
- Android项目执行时报错NoclassDefFoundError
导Android项目时碰到个头疼的NoclassDefFoundError. 项目导入之后是没有报错的.可是执行就报这个错误 java.lang.NoClassDefFoundError: andro ...
- type 'simple Class' does not conform to protocol 'Example Protocol'错误
在看swift教程中"接口和扩展"这小部分. 在编写时提示"type 'simple Class' does not conform to protocol 'Examp ...
- [BZOJ4826][HNOI2017]影魔 可持久化线段树
链接 题意:给你 \(1\) 到 \(n\) 的排列 \(k_1,k_2,\dots,k_n\) ,对 \(i,j (i<j)\)来说,若不存在 \(k_s (i<s<j)\) 大于 ...