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

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
除以二,统计余数相同的个数
#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

Problem Description
Little
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.

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

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.

 
Output
For each test case, print a single line containing a string t in the format of HH:MM, where t(00:00≤t≤23:59), denoting the time shown on the clock.
 
Sample Input
1
.XX...XX.....XX...XX.
X..X....X......X.X..X
X..X....X.X....X.X..X
......XX.....XX...XX.
X..X.X....X....X.X..X
X..X.X.........X.X..X
.XX...XX.....XX...XX.
 
Sample Output
02:38
模拟。代码估计十分冗长
#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的更多相关文章

  1. 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) ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. Linux防火墙iptables介绍

    介绍网络防火墙是通过一个或多个允许或拒绝的规则来过滤网络流量的网络设备或软件.网络防火墙还可以执行更复杂的任务,例如网络地址转换,带宽调整,提供加密隧道以及更多与网络流量相关的任务.而我们的任务就是需 ...

  2. 利用中间件 mysql_proxy 完成 mysql 的负载均衡和读写分离

      安装 mysql_proxy       cd /usr/local/src       wget http://mysql.cdpa.nsysu.edu.tw.Downloads/MySQL - ...

  3. HDU-1878 欧拉回路 欧拉回路

    题目链接:https://cn.vjudge.net/problem/HDU-1878 题意 中文题,而且就是单纯的欧拉回路 思路 判断连通图 用并查集会很好,bfs亦可 一时脑抽用bfs过了这个题, ...

  4. Ubuntu 环境下的mysql 远程访问,redis 远程访问和设置密码 ,mongo 安装 ,设置用户密码,开启远程访问

    MySQL远程访问 1.编辑mysql配置文件,把其中bind-address = 127.0.0.1注释了 vi /etc/mysql/mysql.conf.d/mysqld.cnf 2.使用roo ...

  5. svn 的使用(二)

    这篇主要介绍下 svn 钩子的使用,svn 的安装以及配置等能够查看svn 的使用(一) 我们能够在svn创建的仓库目录下看到 hooks 目录. 这里面就存放这个各种svn操作同一时候会运行的脚本文 ...

  6. ListView阻尼效果

    效果图省略.. . activity_main.xml(仅仅有一个自己定义ListView) <RelativeLayout xmlns:android="http://schemas ...

  7. CF 558A(Lala Land and Apple Trees-暴力)

    A. Lala Land and Apple Trees time limit per test 1 second memory limit per test 256 megabytes input ...

  8. CentOS 搭建 Mysql MMM 高可用架构

    环境 CentOS Mysql 5.1 前提 安装了EPEL,详细安装步骤请參照 http://blog.csdn.net/robinsonmhj/article/details/36184863 机 ...

  9. Sam做题记录

    Sam做题记录 Hihocoder 后缀自动机二·重复旋律5 求一个串中本质不同的子串数 显然,答案是 \(\sum len[i]-len[fa[i]]\) Hihocoder 后缀自动机三·重复旋律 ...

  10. doT.js灵活运用之嵌入使用

    基础的base_info_area <div id="base_info_area"></div> <script type="text/h ...