(2016弱校联盟十一专场10.3) A.Best Matched Pair
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stack>
using namespace std;
int n,data[];
int cal(int x) {
int tx=x;
int pre=-;
while(tx) {
if(pre!=-&&tx%-pre!=-) return -;
pre = tx%;
tx/=;
}
return x;
}
int main() {
scanf("%d",&n);
for(int i=;i<n;i++) scanf("%d",&data[i]);
int ans = -;
for(int i=;i<n;i++)
for(int j=i+;j<n;j++) {
ans = max(ans,cal(data[i]*data[j]));
}
printf("%d\n",ans);
}
(2016弱校联盟十一专场10.3) A.Best Matched Pair的更多相关文章
- 2016弱校联盟十一专场10.5---As Easy As Possible(倍增)
题目链接 https://acm.bnu.edu.cn/v3/contest_show.php?cid=8506#problem/A problem description As we know, t ...
- 2016弱校联盟十一专场10.3---Similarity of Subtrees(深搜+hash、映射)
题目链接 https://acm.bnu.edu.cn/v3/problem_show.php?pid=52310 problem description Define the depth of a ...
- (2016弱校联盟十一专场10.3) D Parentheses
题目链接 把左括号看成A右括号看成B,推一下就行了.好久之前写的,推到最后发现是一个有规律的序列. #include <bits/stdc++.h> using namespace std ...
- (2016弱校联盟十一专场10.3) B.Help the Princess!
题目链接 宽搜一下就行. #include <iostream> #include<cstdio> #include<cstring> #include<qu ...
- 2016弱校联盟十一专场10.3---We don't wanna work!(STL--set的使用)
题目链接 https://acm.bnu.edu.cn/v3/contest_show.php?cid=8504#problem/C 代码如下: #include <iostream> # ...
- 2016弱校联盟十一专场10.2---Around the World(深搜+组合数、逆元)
题目链接 https://acm.bnu.edu.cn/v3/problem_show.php?pid=52305 problem description In ICPCCamp, there ar ...
- (2016弱校联盟十一专场10.2) A.Nearest Neighbor Search
题目链接 水题,算一下就行. #include <bits/stdc++.h> using namespace std; typedef long long ll; ll x[],y[], ...
- (2016弱校联盟十一专场10.2) E.Coins
题目链接 很久之前写的了,好像是对拍打表过的,推一下就行了. #include <bits/stdc++.h> using namespace std; typedef long long ...
- (2016弱校联盟十一专场10.5) F. Fibonacci of Fibonacci
题目链接 题目大意就是这个,先找出下标的循环节,再快速幂对20160519取余就行了. 找出下标循环节: #include <cstdio> #include <iostream&g ...
随机推荐
- DayPilot 7.8 DLL去DEMO字样下载
来自 DayPilot 的 7.8.3169.1 版本的DLL,微调去掉了“DEMO”字样,供参考,商用请支持正版! 此处下载: http://files.cnblogs.com/files/pcca ...
- HMAC加密的消息摘要码
HMAC(Hash Message Authentication Code)哈希消息授权码,它在消息摘要算法(例如MD5,SHA系列算法)的基础上,使用密钥对消息摘要进行加密.它相当于一个马甲,内里可 ...
- Sniffer的完整代码,基于winpcap抓包统计吞吐量
using System; using System.Net; using System.Net.Sockets; using System.Net.NetworkInformation; using ...
- Matlab2015矩阵表示03
1. 矩阵表示 >>行元素分隔: 空格'space'或逗号',' >>列分隔: 分号或回车换行符 2. 冒号表达式 1) start:end 2) start: step : ...
- 微信小程序-关于post 过来服务器没有获取到数据问题
查看一下服务器接收的post 参数是以什么形式接收的 微信给出得demo 请求的方式是Json 参数传递的 所以如果服务器使用的from 表单形式接收数据需要更改微信小程序中的 header 将 he ...
- centos7 安装jdk1.8
安装之前下熟悉以下连个文件 (1)/etc/profile 全局(公有)配置,不管是哪个用户,登录时都会读取该文件. (2)~/.bashrc: 该文件包含专用于你的bash shell的bas ...
- JUnit备忘录
测试方法不应该有参数 使用junit做测试的时候发现总是报错:Method XXX should have no parameters; 后来发现是因为测试方法里面函数参数
- input-placeholder
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: #f00; } ::-moz-placeholder { /* Mozilla Fir ...
- php以pdo方式连接sqlserver,无法开启sqlsrv扩展
首先,PHP连接sqlserver代码如下: $host="aaaaa"; $dbname="aaaaa"; $user="aaaaa"; ...
- <<< 三大框架简短介绍
Struts 搞业务 Spring 主要是AOP(面向方面编程)和IOC(控制反转)它里面用到很多的设计模式Hibernate Orm映射工具 实现面向对象的方式操作数据库hibernate 封装了j ...