757B Bash's Big Day
来源:互联网 发布:淘宝开店审核期去哪查 编辑:程序博客网 时间:2024/06/16 23:37
题目链接:
http://codeforces.com/contest/757/problem/B
题解:
大致题意:
给你n个数,问这些数中互相gcd的值不为的1的有多少(要取最大值)
很好的一个思维题,自己是用暴力打表的方法来做的。
代码:
#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;#define met(a,b) memset(a,b,sizeof(a))const int maxn = 1e5;#define inf 0x3f3f3f3fint visited[maxn];int main(){ int n; while(cin>>n) { met(visited,0); for(int i=0;i<n;i++) { int num; cin>>num; visited[num]++; } int ans=1; for(int i=2;i<maxn;i++) { int temp=0; for(int j=i;j<=maxn;j+=i) temp+=visited[j]; ans=max(ans,temp); } cout<<ans<<endl; }}
0 0
- codeforces 757 B. Bash's Big Day
- Codeforces 757 B Bash's Big Day
- 【codeforces 757B】 Bash's Big Day
- 757B Bash's Big Day
- cf 757B Bash's Big Day
- Codeforces 757B Bash's Big Day math, number theory
- Codeforces 757B Bash's Big Day【线性筛】
- CodeForces - 757B Bash's Big Day (分解素因子)
- Codeforces 757B Bash's Big Day 【数论】
- codeforces-757-B Bash's Big Day(简单题)
- 757B. Bash's Big Day(分解因子)
- codeforce B. Bash's Big Day
- Codeforces Round #391 -B. Bash's Big Day
- 【Codeforces 757 Bash's Big Day】+ 手速
- Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) B - Bash's Big Day 枚举
- Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) -- B. Bash's Big Day (唯一分解定理)
- Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) B. Bash's Big Day 数论+贪心
- CF757B: Bash's Big Day(分解质因子)
- POJ - 1321 dfs [kuangbin带你飞]专题一
- Microsoft Kinect 2 and ubuntu 14.04 and ROS Indigo and RGBD SLAM and RTAB Map 详细配置及comments
- PAT甲级 1006.Sign In and Sign Out(25) 题目翻译与答案
- 题目1:斐波那契数列(兔子出生规律)
- javascript this的一些误解
- 757B Bash's Big Day
- Kaggle_news_stock简单文本特征处理
- 使用python开发json、csv数据格式转换工具
- mysql存储过程 --游标的使用 取每行记录 (多字段)
- leetcode Longest Substring Without Repeating Characters解题记录
- 百度C++面试题
- 软件上线标准
- redis
- Verilog HDL语言中always敏感信号对比分析