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内产生内存,否 ...
随机推荐
- OpenGL ES 2.0 Shader 调试新思路(一): 改变提问方式
OpenGL ES 2.0 Shader 调试新思路(一): 改变提问方式 --是什么(答案是具体值) VS 是不是(答案是布尔值) 目录 背景介绍 问题描述 Codea 是 iPad 上的一款很方便 ...
- C - Segments POJ - 3304 (判断线段相交)
题目链接:https://vjudge.net/contest/276358#problem/C 题目大意:给你n条线段,问你是否存在一条线段使得所有的线段在这条直线的投影至少具有一个交点? 具体思路 ...
- 05 uni-app框架学习:uni-app设置全局变量的方法
原文地址:https://ask.dcloud.net.cn/article/35021
- [转]CMake cache
CMakeCache.txt 可以将其想象成一个配置文件(在Unix环境下,我们可以认为它等价于传递给configure的参数). CMakeLists.txt 中通过 set(... CACHE . ...
- keepalived启动不成功,状态一直是inactive(dead) 的解决办法以及keepalived高版本没有rc.d目录,虚拟VIP无法访问问题
安装配置教程我就不说了,网上很多,这里只给出我遇到的两个坑: 1 rc.d目录 ,kp在1.4版本之后rc.d要去解压之后的源码包里去找,make之后的目录里面没有了,我使用的是2.0.13最新版本, ...
- 【linux kernel】 中断处理-中断上半部【转】
转自:http://www.cnblogs.com/embedded-tzp/p/4451354.html 欢迎转载,转载时需保留作者信息,谢谢. 邮箱:tangzhongp@163.com 博客园地 ...
- expect学习笔记及实例详解【转】
1. expect是基于tcl演变而来的,所以很多语法和tcl类似,基本的语法如下所示:1.1 首行加上/usr/bin/expect1.2 spawn: 后面加上需要执行的shell命令,比如说sp ...
- 四、vue语法补充
1.自定义过滤器 格式: {{ msg | filters}} 2.computed 属性默认只有 getter ,不过在需要时你也可以提供一个 setter <!DOCTYPE html> ...
- liunx jdk安装
打开https://www.oracle.com/technetwork/java/javase/downloads/index.html 选择Development版本(server为服务器版本), ...
- 标签流 VS 脚本流
搞过点前端,玩过几个框架之后,基本都会发现框架在设计上的一些套路和流派,今天给大家扒一扒其中的两个书写流派“标签流”和“脚本流” 我们以一个button按钮为例: 这样裸写HTML标签的方式基本没法儿 ...