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 ...
随机推荐
- HTTP Basic Authentication
Client端发送请求, 要在发送请求的时候添加HTTP Basic Authentication认证信息到请求中,有两种方法:1. 在请求头中添加Authorization: Authoriz ...
- [译]了解AngularJS $resource
原文: https://learnable.com/books/angularjs-novice-to-ninja/preview/understanding-angularjs-resource-e ...
- 清北国庆day1 (脑)残
(留坑) /* 不知道为什要找的循环节TM这么长 */ #include<cstdio> #include<cstdlib> #include<cstring> u ...
- 微信电脑版即将到来了 安装QQ浏览器微信版体验吧
之前说过在手机上微信打字慢,tx最终还是想开了,最近TX邀请测试微信电脑版,想要尝鲜的朋友可以去exp.qq.com申请QQ浏览器微信版体验,不过体验将要结束了,相信正式版很快就要出来了.[微信网页版 ...
- linux远程复制和压缩文件的命令
1.linux导出指定数据库表 mysqldump 127.0.0.1 -uname -ppwd databasename tablename>/home/name/tablename. ...
- springmvc之定时器
一.通过注解方式实现定时器 1.工程结构 2.所需jar包 3.spring-config.xml,springmvc配置文件 <?xml version="1.0" enc ...
- 解决Button设置disabled后无法执行后台代码问题
一.开始调式下面的程序,发现Button在js中设置disabled后无法执行后台代码(btnsave_Click)问题 <asp:Button ID="btnsave" r ...
- iOS开发——多线程篇——RunLoop
一.简介 1.什么是RunLoop从字面意思看运行循环跑圈 基本作用保持程序的持续运行处理App中的各种事件(比如触摸事件.定时器事件.Selector事件)节省CPU资源,提高程序性能:该做事时做事 ...
- js引出函数概念的案例
js引出函数概念的案例 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8&q ...
- Android学习笔记(一)——新建一个项目
//此系列博文是<第一行Android代码>的学习笔记,如有错漏,欢迎指正! 1.打开Android Studio时出现以下界面,点击”start a new Android Studio ...