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. js字符串首字母转为大写

    function initialsLetterUpperCase(arr){ if(Array.isArray(arr)){ return arr.map(function(val,index,arr ...

  2. vue之filter用法

    1.全局写法: 全局过滤器必须写在vue实例创建之前. Vue.filter('testfilter', function (value,text) { // 返回处理后的值 return value ...

  3. qduoj~前端~二次开发

    青岛大学qdu的onlinejudge是js的写的前端,框架是vue.js,在nodejs上部署运行,其实整体运行还是建立在docker的容器虚拟环境里,这里暂时不需要docker.安装环境是Ubun ...

  4. NetHogs---按进程或程序实时统计网络带宽使用率。

    NetHogs是一个开源的命令行工具(类似于Linux的top命令),用来按进程或程序实时统计网络带宽使用率. 来自NetHogs项目网站: NetHogs是一个小型的net top工具,不像大多数工 ...

  5. select &amp; epoll

    同步.异步.堵塞和非堵塞差别 同步:发出一个功能调用时.在没有得到结果之前,该调用就不返回 异步:当一个异步过程调用发出后.调用者不能立马得到结果.实际处理这个调用的部件在完毕后.通过状态.通知和回调 ...

  6. sass01

    Chrome --流行的浏览器,及前端开发调试工具 WebStorm --强大的跨平台前端集成开发环境 Sublime Text --神器级别的代码编辑器,如vim般强大,而上手难度极低. ----- ...

  7. .Net 安装aliyun-oss

    NuGet安装 如果您的Visual Studio没有安装NuGet,请先安装 NuGet. 安装好NuGet后,先在Visual Studio中新建或者打开已有的项目,然后选择工具 > NuG ...

  8. windows常用命令有哪些(整理)

    windows常用命令有哪些(整理) 一.总结 一句话总结:其实这个好学,只要先弄懂主干,清除主干,那么枝叶的添加逻辑就很清除了 这种多内容的,散乱的,弄清除主干效率就高了 1.windows命令行的 ...

  9. .net 项目分层及规范

       1.解决方案命名:公司简称+产品名称.如ABCSOft.BBS 2.解决方案文件夹:以数字排序例如:01.Web表示页面层:02.IBusinessLogic表示业务逻辑接口:03.Bussin ...

  10. UVA And Then There Was One

    约瑟夫环问题,只不过每次删除一个后,在移m的倍数. #include <iostream> #include <cstdio> #include <cstring> ...