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

求lcm,爆了long long。我得好好反省一下,对连乘不敏感

#include<bits/stdc++.h>
using namespace std;
typedef long long ll; const int maxn = 1e5+;
ll a[maxn]; int main()
{
//freopen("in.txt","r",stdin);
int n;
scanf("%d",&n);
for(int i = ; i < n; i++){
scanf("%I64d",a+i);
while(a[i]% == ) a[i]/=;
while(a[i]% == ) a[i]/=;
}
for(int i = ; i < n; i++){
if(a[i]!=a[i-]) {
puts("NO"); return ;
}
}
puts("YES");
return ;
}

Codeforces Round #318 (Div. 2) C Bear and Poker (数学)的更多相关文章

  1. Codeforces Round #318 (Div. 2) D Bear and Blocks (数学)

    不难发现在一次操作以后,hi=min(hi-1,hi-1,hi+1),迭代这个式子得到k次操作以后hi=min(hi-j-(k-j),hi-k,hi+j-(k-j)),j = 1,2,3... 当k ...

  2. Codeforces Round #318 (Div. 2) B Bear and Three Musketeers (暴力)

    算一下复杂度.发现可以直接暴.对于u枚举a和b,判断一下是否连边,更新答案. #include<bits/stdc++.h> using namespace std; int n,m; ; ...

  3. Codeforces Round #318 (Div. 2) A Bear and Elections (优先队列模拟,水题)

    优先队列模拟一下就好. #include<bits/stdc++.h> using namespace std; priority_queue<int>q; int main( ...

  4. Codeforces Round #368 (Div. 2) C. Pythagorean Triples(数学)

    Pythagorean Triples 题目链接: http://codeforces.com/contest/707/problem/C Description Katya studies in a ...

  5. Codeforces Round #622 (Div. 2) B. Different Rules(数学)

    Codeforces Round #622 (Div. 2) B. Different Rules 题意: 你在参加一个比赛,最终按两场分赛的排名之和排名,每场分赛中不存在名次并列,给出参赛人数 n ...

  6. Codeforces Round #318(Div 1) 573A, 573B,573C

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud 这场的前两题完全是手速题...A题写了7分钟,交的时候已经500+了,好在B题出的 ...

  7. Codeforces Round #284 (Div. 2)A B C 模拟 数学

    A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard ...

  8. Codeforces Round #356 (Div. 2) C. Bear and Prime 100(转)

    C. Bear and Prime 100 time limit per test 1 second memory limit per test 256 megabytes input standar ...

  9. Codeforces Round #356 (Div. 2)B. Bear and Finding Criminals(水题)

    B. Bear and Finding Criminals time limit per test 2 seconds memory limit per test 256 megabytes inpu ...

随机推荐

  1. ECharts使用问题

    Echarts官网上给的例子,在最后有一个分号. 使用ajax请求,在eval()转化时出现错误,原因就是因为多了一个分号

  2. java.endorsed.dirs

    java.ext.dirs 用于扩展jdk的系统库,那么 -Djava.endorsed.dirs 又有什么神奇的作用呢? java提供了endorsed技术: 关于endorsed:可以的简单理解为 ...

  3. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs&qu ...

  4. python3 类 组合

    解决类与类之间代码冗余问题有两种解决方案: 第一 是继承,第二是组合 1:继承   描述的是类与类之间的也就是什么是什么的关系 2: 组合  描述的是类与类之间的关系,  是一种什么有什么的关系的,也 ...

  5. HDU - 2181 哈密顿绕行世界问题 dfs图的遍历

    哈密顿绕行世界问题 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  6. Qt测试代码执行时间

    ////////////////////////////////////////////////////////////////// QString _GetIntervalTime(QTime&am ...

  7. lightoj 1078【同余定理】

    题意: 给你一个n和一个数 digit ,问你最少需要多少个 digit 使得整除于n; 思路: 同余定理(a+b)%n=(a%n+b%n)%n; (m%n+m%n*10+m%n*100+m%n*10 ...

  8. uoj#275. 【清华集训2016】组合数问题(数位dp)

    传送门 假设有\(k|{n\choose m}\),因为\(n!\)中质因子\(k\)的次数为\(S(n)=\left\lfloor\frac{n}{k}\right\rfloor+\left\lfl ...

  9. Validation(2)

    站在巨人的肩膀上 spring注解式参数校验 2016年06月15日 15:42:47 God_Ming 阅读数:57021 标签: springhibernatevalidator 更多 个人分类: ...

  10. Yac - PHP扩展

    1:首先你要安装Git [root@localhost]# git clone https://github.com/laruence/yac 2:进入yac目录进行配置 [root@localhos ...