Codeforces Round #511 (Div. 2)
Codeforces Round #511 (Div. 2)
#include <bits/stdc++.h>
using namespace std;
int n;
int main()
{
cin>>n;
)%) cout<<<<endl;
<<endl;
}
A. Little C Loves 3 I
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin>>n;
;
int a,b;
; i<=n; ++i) {
cin>>a>>b;
ans=max(ans,a+b);
}
cout<<ans<<endl;
}
B - Cover Points
#include <bits/stdc++.h>
using namespace std;
;
;
int n,g;
int a[maxn];
int cnt[N];
int vis[N];
int main() {
std::ios::sync_with_stdio(false);
cin.tie(NULL);
while(cin>>n) {
; i<=n; ++i) {
cin>>a[i];
) g=a[i];
g=__gcd(g,a[i]);
}
memset(cnt,,sizeof(cnt));
memset(vis,,sizeof(vis));
; i<=n; ++i) {
++cnt[a[i]/g];
}
;
; i<=N; ++i) {
) {
;
for(int j=i; j<N; j+=i) {
res+=cnt[j];
vis[j]=;
}
ans=max(ans,res);
}
}
if(ans)
cout<<n-ans<<endl;
else cout<<"-1"<<endl;
}
}
C - Enlarge GCD
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#define lson i<<1
#define rson i<<1|1
#define LS l,mid,lson
#define RS mid+1,r,rson
#define mem(a,x) memset(a,x,sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define ll long long
#define ull unsigned long long
#define lowbit(x) (x&-x)
#define pb(x) push_back(x)
#define enld endl
#define mian main
#define itn int
#define prinft printf
#pragma GCC optimize(2)
//#pragma comment(linker, "/STACK:102400000,102400000")
const double PI = acos (-1.0);
const int INF = 0x3f3f3f3f;
;
;
;
;
using namespace std;
ll n,m;
int main() {
//std::ios::sync_with_stdio(false);
//cin.tie(NULL);
while(cin>>n>>m) {
if(n>m) swap(n,m);
==) {
n=n/;
) cout<<<<endl;
) cout<<n*<<endl;
&&m!=) cout<<n**m<<endl;
) cout<<*n<<endl;
} ) {
n=n/-;
) cout<<<<endl;
) cout<<n*+<<endl;
==) cout<<n**m+*m<<endl;
) cout<<n**m+*m-<<endl;
*n+<<endl;
} ) {
//if(m%6==0) cout<<m<<endl;
<=) cout<<m/*<<endl;
*+(m%)%*<<endl;
}
}
}
D - Little C Loves 3 II
Codeforces Round #511 (Div. 2)的更多相关文章
- Codeforces Round #511 (Div. 2):C. Enlarge GCD(数学)
C. Enlarge GCD 题目链接:https://codeforces.com/contest/1047/problem/C 题意: 给出n个数,然后你可以移除一些数.现在要求你移除最少的数,让 ...
- Codeforces Round #511 (Div. 2)-C - Enlarge GCD (素数筛)
传送门:http://codeforces.com/contest/1047/problem/C 题意: 给定n个数,问最少要去掉几个数,使得剩下的数gcd 大于原来n个数的gcd值. 思路: 自己一 ...
- Codeforces Round #511 (Div. 1) C. Region Separation(dp + 数论)
题意 一棵 \(n\) 个点的树,每个点有权值 \(a_i\) .你想砍树. 你可以砍任意次,每次你选择一些边断开,需要满足砍完后每个连通块的权值和是相等的.求有多少种砍树方案. \(n \le 10 ...
- Codeforces Round #511 Div.1 A Div.2 C
嗯切一题走人很开心. gzy-50分比我还惨. 题意:有n个数,去掉尽量少的数使得剩下数的gcd变大. 首先把这n个数都除以gcd,就变成了去掉尽量少的数使得gcd不等于1. 可以枚举一个质数,然后统 ...
- 2018.9.21 Codeforces Round #511(Div.2)
只写了AB,甚至还WA了一次A题,暴露了蒟蒻的本质=.= 感觉考的时候有好多正确或和正解有关的思路,但是就想不出具体的解法或者想的不够深(长)(怕不是过于鶸) 话说CF的E题怎么都这么清奇=.= A. ...
- C. Enlarge GCD Codeforces Round #511 (Div. 2)【数学】
题目: Mr. F has nn positive integers, a1,a2,…,an. He thinks the greatest common divisor of these integ ...
- B. Cover Points Codeforces Round #511 (Div. 2)【数学】
题目: There are nn points on the plane, (x1,y1),(x2,y2),…,(xn,yn)(x1,y1),(x2,y2),…,(xn,yn). You need t ...
- A. Little C Loves 3 I Codeforces Round #511 (Div. 2) 【数学】
题目: Little C loves number «3» very much. He loves all things about it. Now he has a positive integer ...
- Codeforces Round #511 (Div. 2) C. Enlarge GCD
题目链接 题目就是找每个数的最小素因子,然后递归除,本来没啥问题,结果今天又学习了个新坑点. 我交了题后,疯狂CE,我以为爆内存,结果是,我对全局数组赋值, 如果直接赋值,会直接在exe内产生内存,否 ...
随机推荐
- POJ 3710 无向图简单环树上删边
结论题,这题关键在于如何转换环,可以用tarjan求出连通分量后再进行标记,也可以DFS直接找到环后把点的SG值变掉就行了 /** @Date : 2017-10-23 19:47:47 * @Fil ...
- 机器学习算法整理(七)支持向量机以及SMO算法实现
以下均为自己看视频做的笔记,自用,侵删! 还参考了:http://www.ai-start.com/ml2014/ 在监督学习中,许多学习算法的性能都非常类似,因此,重要的不是你该选择使用学习算法A还 ...
- Repeater控件的分页实现
本文讲解Repeater控件与PagedDataSource相结合实现其分页功能.PagedDataSource 类封装那些允许数据源控件(如 DataGrid.GridView)执行分页操作的属性. ...
- TED_Topic8:How to control someone else's arm with your brain
By Greg Gage (Neuroscientist) Greg Gage is on a mission to make brain science accessible to all. In ...
- java关于图片处理修改图片大小
最近做了一个关于图片浏览的内容.因为图片都是一些证件的资料的扫描件所以比较大,对系统的影响也是非常之大的,有很大可能直接把系统干死.那么我是这么处理的,给大家分享一下.如果大家有好的方案的话一定要早点 ...
- android休眠唤醒驱动流程分析【转】
转自:http://blog.csdn.net/hanmengaidudu/article/details/11777501 标准linux休眠过程: l power managemen ...
- find查找时排除目录及文件
查找根目录下大于500M的文件,排除/proc目录 find / ! -path "/proc/*" -type f -size +500M | sort -rh|xargs ls ...
- SharePoint 2013 另一个程序正在使用此文件,进程无法访问。 (异常来自 HRESULT:0x80070020)
环境:SharePoint 2013 + Windows Server 2012 R2 在管理中心新建一个Web Application,端口为:88.顺利创建网站集后,打开访问却提示:无法显示此页 ...
- 八、vue使用element-ui组件
element-ui组件 1.引入element import Vue from 'vue'; import ElementUI from 'element-ui'; import 'element- ...
- wpf XAML 设计器异常,提示NullReferenceException 未将对象引用设置到对象例
设计了一个控件,然后在使用该控件的界面上,出现上图,这个应该是设计器的bug,解决办法 不要在界面上直接写Load事件 在cs构造函数里手动注册,并且在控件的构造函数里增加判断 if (Designe ...