best matched pair



今天的模拟赛,被虐的不行。。。。英文太差,弄不懂题意,弄懂题意了还不会。。。
感觉快要受不了了。。。
#include <iostream>
#include <cstdio>
#include <cstring> using namespace std; int judge(int t){
int intge[];
int cou=;
while(t>=){
int p=t%;
t/=;
intge[cou++]=p;
}
intge[cou++]=t;
for(int i=;i<cou-;i++){
if(intge[i]<=intge[i+]||(intge[i]-intge[i+])!=){
return ;
}
} return ;
} int main()
{
int n;
int a[];
int b=;
while(scanf("%d",&n)!=EOF){
b=;
for(int i=;i<n;i++){
scanf("%d",&a[i]);
}
for(int i=;i<n;i++){
for(int j=;j<n;j++){
if(j!=i){
int t=a[j]*a[i];
if(judge(t)&&b<t){
b=t;
}
}
}
}
if(b==){
printf("-1\n");
}else{
printf("%d\n",b);
}
}
return ;
}
best matched pair的更多相关文章
- (2016弱校联盟十一专场10.3) A.Best Matched Pair
题目链接 #include<cstdio> #include<cstring> #include<algorithm> #include<stack> ...
- Transistor 晶体管 场效应 双极型 达林顿 CMOS PMOS BJT FET
Transistor Tutorial Summary Transistor Tutorial Summary Bipolar Junction Transistor Tutorial We can ...
- POJ #1141 - Brackets Sequence - TODO: POJ website issue
A bottom-up DP. To be honest, it is not easy to relate DP to this problem. Maybe, all "most&quo ...
- 打造自己个性的notepad ++
对coder来说,notepad ++ 是一个很不错的文本编辑器.平时用来看看代码.xml文件,都比系统自带的记事本舒服得多.不过,对于像我这种每天用notepad ++写代码的人,一个原装的note ...
- A Game of Thrones(13) - Tyrion
The north went on forever. Tyrion Lannister knew the maps as well as anyone, but a fortnight on the ...
- [ACM International Collegiate Programming Contest, Amman Collegiate Programming Contest (2018)]
https://codeforces.com/gym/101810 A. Careful Thief time limit per test 2.5 s memory limit per test 2 ...
- Everything You Always Wanted to Know About SDRAM (Memory): But Were Afraid to Ask
It’s coming up on a year since we published our last memory review; possibly the longest hiatus this ...
- Labeled Faces in the Wild 人脸识别数据集
http://blog.csdn.net/garfielder007/article/details/51480525 New (draft) survey paper: Labeled Faces ...
- McNemar test麦克尼马尔检验
sklearn实战-乳腺癌细胞数据挖掘(博主亲自录视频) https://study.163.com/course/introduction.htm?courseId=1005269003&u ...
随机推荐
- CRect类
类CRect是对Windows结构RECT的封装,凡是能用RECT结构的地方都可以用CRect代替. 结构RECT表示一个矩形的位置和尺寸,其定义为: typedef struct tagRECT{ ...
- python的re正则表达式模块学习
python中re模块的用法 Python 的 re 模块(Regular Expression 正则表达式)提供各种正则表达式的匹配操作,在文本解析.复杂字符串分析和信息提取时是一个非常有用的工 ...
- [Linux] Chang DNS Setting on Linux
主机的虚拟机使用 NAT 模式时, NAT的DNS不好用.于是需要将虚拟机的DNS改成和主机的一样,这样虚拟机也可以请求互联网资源. Linux的DNS 服务器定义在 /etc/resolv.conf
- C++ Const引用详解
(1) 在实际的程序中,引用主要被用做函数的形式参数--通常将类对象传递给一个函数.引用必须初始化. 但是用对象的地址初始化引用是错误的,我们可以定义一个指针引用. 1 int ival ...
- 怎样给WordPress分配更多的内存
WordPress如果内存不够,你在操作的时候,就会碰到像这样的问题”Allowed memory size of xxxxxx bytes exhausted”(允许的内存 xxxx 字节已经用光了 ...
- [原创]C 语言select函数
参考链接:http://www.cnblogs.com/GameDeveloper/p/3406565.html 注意点: select() 只是执行一次的超时检测.重新进行select要重新设置“超 ...
- springmvc之前后台传值
一.向后台传值 1.项目结构 2.jar包 3.spring-config.xml <?xml version="1.0" encoding="UTF-8" ...
- javascript高级程序设计---document节点
document节点是文档的根节点,每张网页都有自己的document节点,window.document就是指向这个节点.只要浏览器开始载入文档,这个节点就开始了 对于HTML文档来说,docume ...
- 架设 OpenLDAP服务器
OpenLDAP是一个开放源代码的软件,可以免费获取使用,其主页地址是:http://www.openldap.org/.在RHEL 6上安装OpenLDAP还需要libtool-ltdl-2.2.6 ...
- 简述JavaScript函数节流
为什么要用函数节流 浏览器中某些计算和处理要比其他的昂贵很多.例如,DOM 操作比起非 DOM 交互需要更多的内存和 CPU 时间.连续尝试进行过多的 DOM 相关操作可能会导致浏览器挂起,有时候甚至 ...