CF每日一练 Codeforces Round #520 (Div. 2)
比赛过程总结:过程中有事就玩手机了,后面打的状态不是很好,A题理解错题意,表明了内心不在状态,B题想法和思路都是完全正确的,但是并没有写出来,因为自己代码能力不强,思路不是特别清晰,把代码后面写乱了,而且出现了手误,这非常不应该。
反思:打下来应该想好,打代码的时候一气呵成,尽量避免调BUG,看错题这种低级错误,每天比赛时应该关闭手机。
本场目标:补题A-B-C-D-E
A-
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<map>
#include<vector>
#include<math.h>
using namespace std;
int a[];
int main(){
int n;
while(~scanf("%d",&n)){
int flag=;
int ans=;
for (int i=;i<=n;i++){
scanf("%d",&a[i]);
}
ans=;
int len=;
for (int i=;i<n;i++){
if (a[i]+==a[i+] && flag==){
len++;
if (a[i+]==){
len++;
}
}else if(a[i]+==a[i+] && flag==){
if (a[i]==){
len++;
}
if (a[i+]==){
len++;
}
flag=;
}else if(a[i]+!=a[i+] && flag==){
ans=max(ans,len);
len=;
flag=;
}
}
ans=max(ans,len);
printf("%d\n",ans);
}
return ;
}
B-
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int e[];
int x[];
int kk;
int upbit(int x)
{
int s=;
while(s<x)
{
s*=;
kk++;
}
return s;
}
int main()
{
int n;
while(~scanf("%d",&n))
{
int cnt=;
kk=;
int maxx=;
int ans=;
int ans_k=;
memset(e,,sizeof(e));
memset(x,,sizeof(x));
for(int i=; i*i<=n; i++)
{
if(n%i==)
{
ans*=i;
e[++cnt]=i;
}
int k=;
while(n%i==)
{
n/=i;
k++;
x[cnt]=k;
maxx=max(k,maxx);
}
} if (n!=)
{
e[++cnt]=n;
x[cnt]=;
ans*=n;
}
if (maxx!=)
{
int s=upbit(maxx);
// cout<<maxx<<" "<<s<<endl;
for (int i=; i<=cnt; i++)
{
// cout<<x[i]<<endl;
if (x[i]<s)
{
kk++;
break;
}
}
printf("%d %d\n",ans,kk);
}
else printf("%d 0\n",ans);
}
return ;
}
CF每日一练 Codeforces Round #520 (Div. 2)的更多相关文章
- Codeforces Round #520 (Div. 2)
Codeforces Round #520 (Div. 2) https://codeforces.com/contest/1062 A #include<bits/stdc++.h> u ...
- 【cf比赛记录】Codeforces Round #601 (Div. 2)
Codeforces Round #601 (Div. 2) ---- 比赛传送门 周二晚因为身体不适鸽了,补题补题 A // http://codeforces.com/contest/1255/p ...
- 【cf比赛记录】Codeforces Round #600 (Div. 2)
Codeforces Round #600 (Div. 2) ---- 比赛传送门 昨晚成绩还好,AC A,B题,还能上分(到底有多菜) 补了C.D题,因为昨晚对C.D题已经有想法了,所以补起题来也快 ...
- 【cf比赛记录】Codeforces Round #606 (Div. 2, based on Technocup 2020 Elimination Round 4)
比赛传送门 只能说当晚状态不佳吧,有点头疼感冒的症状.也跟脑子没转过来有关系,A题最后一步爆搜没能立即想出来,B题搜索没有用好STL,C题也因为前面两题弄崩了心态,最后,果然掉分了. A:简单数学 B ...
- Codeforces Round #520 (Div. 2) E. Company(dfs序判断v是否在u的子树里+lca+线段树)
https://codeforces.com/contest/1062/problem/E 题意 给一颗树n,然后q个询问,询问编号l~r的点,假设可以删除一个点,使得他们的最近公共祖先深度最大.每次 ...
- 【cf比赛记录】Codeforces Round #605 (Div. 3)
比赛传送门 Div3真的是暴力杯,比div2还暴力吧(这不是明摆的嘛),所以对我这种一根筋的挺麻烦的,比如A题就自己没转过头来浪费了很久,后来才醒悟过来了.然后这次竟然还上分了...... A题:爆搜 ...
- Codeforces Round #520 (Div. 2) B. Math 唯一分解定理+贪心
题意:给出一个x 可以做两种操作 ①sqrt(x) 注意必须是完全平方数 ② x*=k (k为任意数) 问能达到的最小的x是多少 思路: 由题意以及 操作 应该联想到唯一分解定理 经过 ...
- Codeforces Round #520 (Div. 2) Solution
A. A Prank Solved. 题意: 给出一串数字,每个数字的范围是$[1, 1000]$,并且这个序列是递增的,求最多擦除掉多少个数字,使得别人一看就知道缺的数字是什么. 思路: 显然,如果 ...
- Codeforces Round #520 (Div. 2) D. Fun with Integers
D. Fun with Integers 题目链接:https://codeforc.es/contest/1062/problem/D 题意: 给定一个n,对于任意2<=|a|,|b|< ...
随机推荐
- mssql sqlserver update delete表别名用法简介
转自:http://www.maomao365.com/?p=6973 摘要: 在sql脚本编写中,如果需要在update delete 中使用表别名的方法,必须按照一定的规则编写,否则将会出现相应 ...
- CentOS 6.5 安装mysql 过程记录
下载的时候一定选对应的版本, el6 还是el7 或者其他版本,不然会出现意向不到的惊喜 比如:我刚开始的时候下载的 el7 版本的 mysql , 然后安装的时候 就会出现: libc.so.(GL ...
- Unknown initial character set index '255' received from server. Initial client character set can be
mysql的连接错误,在网上查找到是编码不匹配的原因, 直接在连接的URL后加上?useUnicode=true&characterEncoding=utf8就可以了
- JaveScript 中的正则表达式
1.语法: var expression = /pattern/flags ; pattern: 任何简单或复杂的正则表达式. flags: 可以是 g,i,m 或它们的组合. ...
- Linux系统中Redis和Tomcat的PID文件路径设置
Tomcat: /bin/catalina.sh 文件头注释下面添加一行:CATALINA_PID=/var/run/tomcat.pid Redis: redis.conf配置文件里面搜索pidfi ...
- IIS下MySQL停止和启动的方法
mysql服务的启动与停止:点击开始--运行,输入services.msc , 在弹出的服务窗口中,找到mysql服务,直接点击左侧对应 的就可以了 如下图所示:
- June 2. 2018 Week 22nd Saturday
Try not to become a man of success but rather try to become a man of value. 不要为成功而努力,要为做一个有价值的人而努力. ...
- Markdown语法大全
目录 前言: 1.Markdown基础用法 1.1 目录 1.2 标题 1.3 字体样式 1.4 引用 1.5 图片 1.6 超链接 1.7 列表 1.8 表格 1.9 代码 1.10 流程图 1.1 ...
- C语言入坑指南-被遗忘的初始化
前言 什么是初始化?为什么要初始化?静态变量和局部变量的初始化又有什么区别?实际应用中应该怎么做?本文将一一回答这些问题. 什么是初始化 初始化指的是对数据对象或者变量赋予初始值.例如: int va ...
- (转)Spring Boot 2 (二):Spring Boot 2 尝鲜-动态 Banner
http://www.ityouknow.com/springboot/2018/03/03/spring-boot-banner.html Spring Boot 2.0 提供了很多新特性,其中就有 ...