【题目链接】

点击打开链接

【算法】

若gcd(s1,s2,s3....sk) > 1,

则说明 : 一定存在一个整数d满足d|s1,d|s2,d|s3....,d|sk

因为我们要使|s|尽可能大,所以d是一个质数

对每个数进行质因数分解即可

【代码】

#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5; int N,i,j,tmp,ans;
int a[MAXN+],s[MAXN+]={,}; template <typename T> inline void read(T &x) {
int f = ; x = ;
char c = getchar();
for (; !isdigit(c); c = getchar()) { if (c == '-') f = -f; }
for (; isdigit(c); c = getchar()) x = x * + c - '';
x *= f;
} template <typename T> inline void write(T x) {
if (x < ) { putchar('-'); x = -x; }
if (x > ) write(x/);
putchar(x%+'');
} template <typename T> inline void writeln(T x) {
write(x);
puts("");
} int main() { read(N);
for (i = ; i <= N; i++) read(a[i]);
for (i = ; i <= N; i++) {
tmp = a[i];
for (j = ; j <= sqrt(tmp); j++) {
if (!(tmp % j)) ++s[j];
while (!(tmp % j)) tmp /= j;
}
if (tmp > ) ++s[tmp];
}
for (i = ; i <= MAXN; i++) ans = max(ans,s[i]);
writeln(ans); return ; }

【Codeforces 757B】 Bash's big day的更多相关文章

  1. 【codeforces 757B】 Bash's Big Day

    time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard o ...

  2. 【codeforces 757E】Bash Plays with Functions

    [题目链接]:http://codeforces.com/problemset/problem/757/E [题意] 给你q个询问; 每个询问包含r和n; 让你输出f[r][n]; 这里f[0][n] ...

  3. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  4. 【codeforces 757A】Gotta Catch Em' All!

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  5. 【codeforces 707E】Garlands

    [题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...

  6. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  7. 【codeforces 709D】Recover the String

    [题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...

  8. 【codeforces 709B】Checkpoints

    [题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...

  9. 【codeforces 709C】Letters Cyclic Shift

    [题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...

随机推荐

  1. Go -- 实现二叉搜索树

    树: https://suanfa.herokuapp.com/3%E6%A0%91/binarytree/ 数据结构 首先我们定义需要的数据结构.注意,TreeNode的左右节点都是*TreeNod ...

  2. python解析网页中js动态添加的内容

    https://www.cnblogs.com/asmblog/archive/2013/05/07/3063809.html https://www.zhihu.com/question/21471 ...

  3. Linux学习系列之Iptables

    iptables命令是Linux上常用的防火墙软件,是netfilter项目的一部分.可以直接配置,也可以通过许多前端和图形界面配置. 语法 iptables(选项)(参数) 选项 -t<表&g ...

  4. ormlite

    id 主键 默认为false generatedId 自增长的主键 默认值是false generatedIdSequence 字符串名称的序列号 类同generatedId,但您可以指定序列的名称使 ...

  5. Git的使用 -- 用git玩翻github,结尾有惊喜!有惊喜!有惊喜!林妙妙看了说:牛呲呼啦带闪电 (三)(超详解)

    简介 上一篇主要讲解的是Git安装及配置,这一篇就详细的从无到有的来用Git玩翻github. 一.什么是Github Github是全球最大的社交编程及代码托管网站(https://github.c ...

  6. 释放SQL Server占用的内存 .Net 读取xml UrlReWriter 在web.config中简单的配置

    释放SQL Server占用的内存   由于Sql Server对于系统内存的管理策略是有多少占多少,除非系统内存不够用了(大约到剩余内存为4M左右),Sql Server才会释放一点点内存.所以很多 ...

  7. 各种加载效果,适合做加载loading动画效果 Eclipse版

    Animation.rar 链接: http://pan.baidu.com/s/1c0QkOz2 密码: kd57

  8. scrollTo(String text) and scrollToExact(String text) method of Android Driver not working

    Using the scrollTo(String text) and scrollToExact(String text) method of Android Driver. However the ...

  9. python day-01 (python基础知识1)

    1.计算机组成(参与运算的) 主板+CPU+内存 2.python 简史 解释型语言,弱类型语言(eg:a 可以表示很多意思   a=1  或 a = “小红”) 3.数据类型: int(整数类型): ...

  10. Axure Base 03

    (三)Axure rp元件的触发事件 l  OnClick(点击时): 鼠标点击事件,除了动态面板的所有的其他元件的点击时触发.比如点击按钮. l  OnMouseEnter(鼠标移入时): 鼠标进入 ...