只写了AB,甚至还WA了一次A题,暴露了蒟蒻的本质=。=

感觉考的时候有好多正确或和正解有关的思路,但是就想不出具体的解法或者想的不够深(长)(怕不是过于鶸)

话说CF的E题怎么都这么清奇=。=

A.Little C Loves 3 I

随便拆一下就好了,大概全场就我一个心太急写挂了一次TAT

 #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main ()
{
long long n; scanf("%lld",&n);
if(n%==) printf("%lld 1 2",n-);
else printf("%lld 1 1",n-);
return ;
}

B.Cover Points

初中数学知识(?)或者随手推一推,水水(我**就会这俩水题)

 #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main ()
{
long long n,m,p,ans=;
scanf("%lld",&n);
for(int i=;i<=n;i++)
scanf("%lld%lld",&m,&p),ans=max(m+p,ans);
printf("%lld",ans);
return ;
}

C.Enlarge GCD

题目并不难......

然而被这题确实没做出来,调的时候也调了半天,我好菜啊=。=

首先我们求一个全序列的gcd,然后从每个数中除掉它,剩下的数肯定是互质的,也就是说现在我们要从这些剩下的数中删掉最少的数使得他们不互质。我们将每个数分解质因数,统计出现次数最多的质因数(出现在一个数里算是一次),保留下它肯定就是最优的,于是用总数减去出现次数更新答案即可

 #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=,M=;
int mpr[M],pri[M],cnt[M],num[N];
int n,g,maxx,ans=2e9;
int gcd(int a,int b)
{
return b?gcd(b,a%b):a;
}
inline int maxi(int a,int b)
{
return a>b?a:b;
}
inline int mini(int a,int b)
{
return a<b?a:b;
}
int main ()
{
scanf("%d",&n);
for(register int i=;i<=n;i++)
{
scanf("%d",&num[i]);
g=gcd(g,num[i]),maxx=maxi(maxx,num[i]);
}
mpr[]=;
for(register int i=,sz=;i<=maxx+;i++)
{
if(!mpr[i]) pri[++sz]=mpr[i]=i;
for(register int j=;j<=sz&&i*pri[j]<=maxx+;j++)
{
mpr[i*pri[j]]=i;
if(!(i%pri[j])) break;
}
}
for(register int i=;i<=n;i++)
{
int t=num[i]/g;
for(register int j=;pri[j]*pri[j]<=t;j++)
if(!(t%pri[j]))
{
ans=mini(ans,n-(++cnt[pri[j]]));
while(!(t%pri[j])) t/=pri[j];
}
if(t>) ans=mini(ans,n-(++cnt[t]));
}
if(ans>=n) ans=-;
printf("%d",ans);
return ;
}

D.Little C Loves 3 II

这题毒瘤啊,各种分类海星

比赛的时候怎么就没玩玩小数据呢,明明能A的TAT

首先的首先,要考虑$n*m$的奇偶性,不解释

然后我们可以发现,有些$n*m$是可以填满且无法被其他的$n*m$表示出来的,它们分别是

$1*6$,$2*4$,$2*5$

所以说我们可以考虑用这些块填满棋盘,最后小块单独处理

那么没什么可说的,我们开始讨论吧=。=

1.$n,m$都为偶数

这种情况只有$(2,2)$填不满,别的都可以填满

2.$n,m$都为奇数

有一种特殊情况是有一边的长度为$1$,这种情况要以$1*6$这种填满的填法特殊考虑(代码中的$line$数组就是干这个用的),易证其余情况都是正好剩一个

3.$n,m$一偶一奇

同理于上,根据那三种填满情况特殊考虑,发现我们不能用$4,5,6$凑出来的数只有$1,2,3,7$,$1,2$的情况我们讨论过了,$3,7$特殊讨论一下,然后剩下的肯定都能填满

然后终于做完辣=。=

 #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long line[]={,,,,,};
long long n,m;
int main ()
{
scanf("%lld%lld",&n,&m);
if(n>m) swap(n,m);
if(n==) printf("%lld",m-line[m%]);
else if(!(n&)&&!(m&)) (n==&&m==)?printf(""):printf("%lld",n*m);
else if((n&)&&(m&)) printf("%lld",n*m-);
else
{
if(n&) swap(n,m);
if(n==&&m==) printf("");
else if(n==&&m==) printf("");
else printf("%lld",n*m);
}
return ;
}

E.Region Separation

至今没看懂题意,咕咕咕

2018.9.21 Codeforces Round #511(Div.2)的更多相关文章

  1. Codeforces Round #511 (Div. 2)

    Codeforces Round #511 (Div. 2) #include <bits/stdc++.h> using namespace std; int n; int main() ...

  2. Codeforces Round #511 (Div. 2):C. Enlarge GCD(数学)

    C. Enlarge GCD 题目链接:https://codeforces.com/contest/1047/problem/C 题意: 给出n个数,然后你可以移除一些数.现在要求你移除最少的数,让 ...

  3. Codeforces Round #511 (Div. 2)-C - Enlarge GCD (素数筛)

    传送门:http://codeforces.com/contest/1047/problem/C 题意: 给定n个数,问最少要去掉几个数,使得剩下的数gcd 大于原来n个数的gcd值. 思路: 自己一 ...

  4. Codeforces Round #511 (Div. 1) C. Region Separation(dp + 数论)

    题意 一棵 \(n\) 个点的树,每个点有权值 \(a_i\) .你想砍树. 你可以砍任意次,每次你选择一些边断开,需要满足砍完后每个连通块的权值和是相等的.求有多少种砍树方案. \(n \le 10 ...

  5. Codeforces Round #511 Div.1 A Div.2 C

    嗯切一题走人很开心. gzy-50分比我还惨. 题意:有n个数,去掉尽量少的数使得剩下数的gcd变大. 首先把这n个数都除以gcd,就变成了去掉尽量少的数使得gcd不等于1. 可以枚举一个质数,然后统 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. Codeforces Round #511 (Div. 2) C. Enlarge GCD

    题目链接 题目就是找每个数的最小素因子,然后递归除,本来没啥问题,结果今天又学习了个新坑点. 我交了题后,疯狂CE,我以为爆内存,结果是,我对全局数组赋值, 如果直接赋值,会直接在exe内产生内存,否 ...

随机推荐

  1. ExternalAccessory串口通信

    ExternalAccessory 使用文档 项目下载地址 前言 公司希望通过串口通信的方式实现苹果手机与公司产品进行通信,通过Lighting接口,也就是苹果的数据线.苹果的API External ...

  2. notion笔记

    不错的笔记应用, 模式新颖, 正在使用, 如有相同使用者可以入群交流 notion QQ群 725638123

  3. lspci命令详解

    基础命令学习目录首页 最近经常用到 lspci -nn | grep Eth 命令,需要学习下PCI总线,找到一篇文章,虽然也是转载,但写的较清晰,再次转载下. http://blog.csdn.ne ...

  4. 第十三次作业psp

    psp 进度条 代码累积折线图 博文累积折线图 psp饼状图

  5. Scurm Meeting 11.2

    成员 今日任务 明日计划 用时 徐越 写功能规格说明书,代码移植 创建数据库,代码移植 3h 赵庶宏 编写功能规格说明书,学习访问数据库代码,代码迁移 代码迁移 5h 武鑫 设计界面:独立完成一些简单 ...

  6. 我对git的认识

    Git 真的是不了解 也没听说过git 所以真的不知道从何谈起 所以就参考度娘啦! Git是一个开源的分布式版本控制系统,用以有效.高速的处理从很小到非常大的项目版本管理.Git 是 Linus To ...

  7. windows和RedHat双系统安装说明

    该博客记录了安装windows和RedHat双系统的方法.这里的windows系统是win8.1,RedHat是RHEL-server-7.0-x86_64-LinuxProbe.Com.iso,该i ...

  8. <mvc:annotation-driven/>的作用

    <mvc:annotation-driven>的作用是: 会自动注册DefaultAnnotationHandlerMapping与AnnotationMethodHandlerAdapt ...

  9. tomcat介绍

    Tomcat是Apache 软件基金会(Apache Software Foundation)的Jakarta 项目中的一个核心项目,由java语言编写,需要运行在jvm虚拟机中.之所以Java的应用 ...

  10. Alpha阶段博客链接

    博客链接 团队项目启程篇章:http://www.cnblogs.com/liuliudashun/p/5968194.html 团队项目开发篇章1:http://www.cnblogs.com/li ...