2017 Multi-University Training Contest - Team 4
日常绝望系列
Questionnaire
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 aiai to represent his opinion. When finished, the leader will choose a pair of positive interges m(m>1)m(m>1) and k(0≤k<m)k(0≤k<m), and regard those people whose number is exactly kk modulo mm 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 mm and kk.
InputThe first line of the input contains an integer T(1≤T≤15)T(1≤T≤15), denoting the number of test cases.
In each test case, there is an integer n(3≤n≤100000)n(3≤n≤100000) in the first line, denoting the number of people in the ACM/ICPC team.
In the next line, there are nn distinct integers a1,a2,...,an(1≤ai≤109)a1,a2,...,an(1≤ai≤109), denoting the number that each person chosen.OutputFor 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
这道题最水,看到特判又是膜的,那么m肯定是2啊,这样的话k只有两种结果,模拟下,so easy
#include<bits/stdc++.h>
using namespace std;
int main(){
int T;
scanf("%d",&T);
while(T--){
int n;
scanf("%d",&n);
int one=;
for(int i=;i<n;i++){
int x;
scanf("%d",&x);
if(x&)one++;
}
int f=;
if(one>=(n+)/)f=;
printf("2 %d\n",f);
}
return ;}
Time To Get Up
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.
InputThe first line of the input contains an integer T(1≤T≤1440)T(1≤T≤1440), denoting the number of test cases.
In each test case, there is an 7×217×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.OutputFor each test case, print a single line containing a string tt in the format of HH:MMHH:MM, where t(00:00≤t≤23:59)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
模拟啦,暴力一下就行,分情况讨论7个位置有没有,表示我在这方面的能力有些弱哎
#include<bits/stdc++.h>
using namespace std;
char s[][];
int dfs(int x,int y){
if(s[x][y+]=='X'){
if(s[x+][y+]!='X'){
if(s[x+][y]=='X')
return ;
else
return ;
}
else{
if(s[x+][y+]!='X'){
if(s[x+][y]=='X')
return ;
else return ;
}
else if(s[x+][y+]!='X')
return ;
else if(s[x+][y]=='X')
return ;
else if(s[x+][y]=='X')
return ;
else return ; }
}
else {
if(s[x+][y]=='X')
return ;
else return ;
}
}
int main(){
int T;
scanf("%d",&T);
while(T--){
getchar();
for(int i=;i<;i++)
scanf("%s",s[i]);
printf("%d%d:%d%d\n",dfs(,),dfs(,),dfs(,),dfs(,));
}
return ;}
2017 Multi-University Training Contest - Team 4的更多相关文章
- 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 ...
- 2017 Multi-University Training Contest - Team 1 1001&&HDU 6033 Add More Zero【签到题,数学,水】
Add More Zero Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)T ...
随机推荐
- 11.JAVA-Object类之finalize(),clone(),toString()等方法覆写
1.Object介绍 Object类是一个特殊的类,是所有类(包括数组,接口 )的父类,如果一个类没有用extends明确指出继承于某个类,那么它默认继承Object类,所以可以通过向上转型的方法使用 ...
- GetDC(),ReleaseDC()
用GetDC()得到的DC, 必须调用ReleaseDC()用CreateDC()创建的DC, 必须调用DeleteDC() 两者是不能混淆的.一种典型的错误代码如下:CDC* pDC = GetDC ...
- Android 如何利用Activity的Dialog风格完成弹出框设计
在我们使用Dialog时,如果需要用到很多自己设计的控件,虽然可以让弹出框显示出我们需要的界面,但却无法找到地方完成控制代码的编写,如何解决这个问题呢,我们可以将Activity伪装成Dialog弹出 ...
- 关于软件测试(5):初识Peer Review
一.背景:这周的软件测试课堂上我们在自行分组的情况下,对姚同学的汽车停车位定位管理系统进行了Peer Review,中文就是同行测试.这也是我第一次接触同行测试,那接下来我先介绍一下Peer Revi ...
- SQL Server中变量的声明和使用方法
声明局部变量语法:DECLARE @variable_name DataType其中 variable_name为局部变量的名称,DataType为数据类型.给局部变量赋值有两种方法:1.SET @v ...
- 后台安装 SQL Server 无人值守 安装
(开头闲淡)项目需要必须安装SQL的,查了很久,断断续续用了各种方法,今天终于用了正确的姿(xia)势(mo)弄成了. 最开始用的方法是调用Win的API模拟鼠标操作安装的,嗯,虽然勉强可以,就是有些 ...
- webpack前端构建工具学习总结(三)之webpack.config.js配置文件
Webpack 在执行的时候,除了在命令行传入参数,还可以通过指定的配置文件来执行.默认情况下,会搜索当前目录的 webpack.config.js 文件,这个文件是一个 node.js 模块,返回一 ...
- Cairo Drawing Model
Cairo Drawing Model Cairo是一个强力的2D绘图库. Destination 是你最终绘图的目标, 可以是一系列Pixel或者绑定到SVG或PDF文件上. Source 是实际在 ...
- (转)MyBatis框架的学习(三)——Dao层开发方法
http://blog.csdn.net/yerenyuan_pku/article/details/71700957 使用MyBatis开发Dao层,通常有两个方法,即原始Dao开发方法和Mappe ...
- 在Solr中配置中文分词IKAnalyzer
李克华 云计算高级群: 292870151 交流:Hadoop.NoSQL.分布式.lucene.solr.nutch 在Solr中配置中文分词IKAnalyzer 1.在配置文件schema.xml ...