首页 > 其他 > 详细

(2016弱校联盟十一专场10.3) A.Best Matched Pair

时间:2016-12-22 00:21:25      阅读:246      评论:0      收藏:0      [点我收藏+]

题目链接

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stack>
using namespace std;
int n,data[1005];
int cal(int x) {
    int tx=x;
    int pre=-1;
    while(tx) {
        if(pre!=-1&&tx%10-pre!=-1) return -1;
        pre = tx%10;
        tx/=10;
    }
    return x;
}
int main() {
    scanf("%d",&n);
    for(int i=0;i<n;i++) scanf("%d",&data[i]);
    int ans = -1;
    for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++) {
        ans = max(ans,cal(data[i]*data[j]));
    }
    printf("%d\n",ans);
}

 

(2016弱校联盟十一专场10.3) A.Best Matched Pair

原文:http://www.cnblogs.com/Ritchie/p/6209304.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!