首页 > 其他 > 详细

Codeforces Round #318 (Div. 2) C Bear and Poker

时间:2015-08-30 09:52:08      阅读:150      评论:0      收藏:0      [点我收藏+]

很简单,求一下所有数的2和3的幂是任意调整的,把2和3的因子除掉以后必须相等。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const int maxn = 1e5+5;
ll a[maxn];


int main()
{
    //freopen("in.txt","r",stdin);
    int n;
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%I64d",a+i);
        while(a[i]%2 == 0) a[i]/=2;
        while(a[i]%3 == 0) a[i]/=3;
    }
    for(int i = 1; i < n; i++){
        if(a[i]!=a[i-1]) {
            puts("NO"); return 0;
        }
    }
    puts("YES");
    return 0;
}

 

Codeforces Round #318 (Div. 2) C Bear and Poker

原文:http://www.cnblogs.com/jerryRey/p/4770260.html

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