简单题,求一下所有数的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. 总结open与fopen的区别

    https://www.zybuluo.com/yiltoncent/note/87461 参考链接1 参考链接2 对于这两个名字很类似的函数,对于很多初学者来说,不容易搞清楚它们有什么不同,只知道按 ...

  2. CodeForces 359D Pair of Numbers (暴力)

    题意:给定一个正整数数组,求最长的区间,使得该区间内存在一个元素,它能整除该区间的每个元素. 析:暴力每一个可能的区间,从数组的第一个元素开始考虑,向两边延伸,设延伸到的最左边的点为l, 最右边的点为 ...

  3. JQuery学习笔记(三)遍历 DOM

    遍历 DOM jQuery 提供了多种遍历 DOM 的方法.遍历方法中最大的种类是树遍历(tree-traversal). 向上父节点parent,向下子节点child,同胞next和pre 缩写搜索 ...

  4. LuaToC#

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  5. POJ3463【次短路】

    转自:http://www.cnblogs.com/jackge/archive/2013/04/29/3051273.html 算法:最短路和次短路.Dijkstra算法.采用邻接表建图. 总结:不 ...

  6. JAG Practice Contest for ACM-ICPC Asia Regional 2016B题【BFS】

    题意: 就是公主要逃跑,士兵要抓公主,问你能不能逃跑哇: 思路: 就是终点搞成起点,然后BFS一下就好了,最后枚举一下出口到公主的距离是不是<所有的到士兵的距离: #include <bi ...

  7. Oracle Java SE 组件概念图

    JDK1.8 组件概念图

  8. Java | 基础归纳 | JPA

    https://www.javacodegeeks.com/2015/04/jpa%E5%85%A5%E9%97%A8%E6%95%99%E7%A8%8B.html JPA 全称====>Jav ...

  9. python操作rabbitmq实现消息过滤接收

    目标: 代码实现(direct_product.py) # __author__ = 'STEVEN' import pika,sys #开启socket connection = pika.Bloc ...

  10. 最新Centos7安装python3并与python2共存

    1.查看是否已经安装Python CentOS 7.2 默认安装了python2.7.5 因为一些命令要用它比如yum 它使用的是python2.7.5. 使用 python -V 命令查看一下是否安 ...