只写了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. 如何解决zabbix snmp异常超时、不稳定、时通时断:Timeout

    针对平时工作中,zabbix snmp出现异常超时.不稳定.时通时断:Timeout while connecting 等的情况,以下我将以使用乐维监控为例,进行解决方案的详细叙述.   一.问题:设 ...

  2. <React Native移动开发实战>-1-React Native的JSX解决方案

    JSX并不是一门新的开发语言,而是Facebook提出的语法方案:一种可以在JavaScript代码中直接书写HTML标签的语法糖,所以,JSX本质上还是JavaScript语言. 小知识:语法糖(S ...

  3. Codeforces1101 | EducationalRound58 | 瞎讲报告

    目录 Educational Codeforces Round 58 (Rated for Div. 2) A. Minimum Integer B. Accordion C. Division an ...

  4. Windows环境下,从零开始搭建Nodejs+Express+Ejs框架(二)---安装Express,ejs

    安装Express,ejs的前提是一定要先安装nodejs,具体安装方法请查看 http://www.cnblogs.com/tfiremeteor/p/8973105.html 安装Express和 ...

  5. js备忘录2

    JavaScript 的类型分为两类,分别是原始类型和对象类型 其中原始类型中只有数字.字符串和布尔型,和java中的有些不一样 null和undefined不是基本数据类型中的某一种 对象是prop ...

  6. 欢迎来怼--第二十二次Scrum会议

    欢迎来怼--第二十二次Scrum会议 一.小组信息 队名:欢迎来怼 小组成员 队长:田继平 成员:李圆圆,葛美义,王伟东,姜珊,邵朔,阚博文 小组照片 二.开会信息 时间:2017/11/10 17: ...

  7. youi软件测试计划

    beta版本中,我们将重视软件开发中的测试. 我们的软件是需要测试的,不测试怎么知道好与不好呢?有的程序不测试甚至都不能运行-- 我们的目标呢:就是经过测试之后软件的质量得到有效的保证.不管什么情况都 ...

  8. web06-PanduanLogin

    电影网站:www.aikan66.com 项目网站:www.aikan66.com 游戏网站:www.aikan66.com 图片网站:www.aikan66.com 书籍网站:www.aikan66 ...

  9. 【Python】LeetCode-155

    一.题目 Design a stack that supports push, pop, top, and retrieving the minimum element in constant tim ...

  10. mvc拦截请求IHttpModule

    代码: using System; using System.Collections.Generic; using System.Linq; using System.Web; using Syste ...