Problem - A - Codeforces

Problem - B - Codeforces

Problem - C - Codeforces

A. Era

每个a[i] - i 表示的是当前a[i]前需要插入几个数, 取所有a[i] - i 最大值即可.

#include <iostream>
#include <algorithm> using namespace std; typedef long long LL; int main(){
int t;
cin >> t; while(t--)
{
int n, x; cin >> n;
int res = 0;
for(int i = 1; i <= n; i ++)
{
cin >> x;
res = max(res, x-i);
}
cout << res <<endl; }
return 0;
}

B. XOR Specia-LIS-t

位运算思维

如果n是偶数的话,可以分成n个序列, 那么偶数个1异或之后必然为0。

那么如果n是奇数, 如果存在一组a[i] <= a[i-1], 将其归为一组, 则n-1个1异或后也必然为0

#include <iostream>
#include <algorithm> using namespace std; typedef long long LL; const int N = 1e5 + 10; int a[N]; int main(){
int t;
cin >> t; while(t--)
{
int n;
cin >> n;
for (int i = 1; i <= n; i ++ )
cin >> a[i]; if(n % 2 == 0)
{
cout << "YES" << endl;
continue;
} bool flag = false;
for (int i = 2; i <= n; i ++ )
if(a[i] <= a[i - 1]) //注意有=号
{
flag = true;
break;
} if(flag)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}

C. Di-visible Confusion

我们可以选择从后往前看这个序列, 这样每删除一个数会尽量不影响其他的数字, 对于每次操作分两种情况:

1. 可以删去a[i]%(i+1) != 0, 没有操作

2. 否则, 如果取余2~i 都为0, 那么这个数算是删不了了, 注定结果失败

只要不失败就成功.

#include <iostream>
#include <algorithm> using namespace std; typedef long long LL; const int N = 1e5 + 10; int a[N]; int main(){
int t;
cin >> t; while(t--)
{
int n; cin >> n; bool res_ok = 1; for(int i = 1; i <= n; i ++) cin >> a[i]; for(int i = n; i >= 1; -- i)
{
if(a[i]%(i+1) == 0)
{
int flag = 0;
for(int j = i; j > 1; -- j)
if(a[i] % j != 0)
{
flag = 1;
break;
} if(!flag)
res_ok = 0;
}
}
if(!res_ok)
puts("NO");
else
puts("YES");
}
return 0;
}

Codeforces Round #752 (Div. 2) A B C的更多相关文章

  1. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  2. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

  3. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

  4. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  5. Codeforces Round #279 (Div. 2) ABCDE

    Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/outpu ...

  6. Codeforces Round #262 (Div. 2) 1003

    Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...

  7. Codeforces Round #262 (Div. 2) 1004

    Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory lim ...

  8. Codeforces Round #371 (Div. 1)

    A: 题目大意: 在一个multiset中要求支持3种操作: 1.增加一个数 2.删去一个数 3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给 ...

  9. Codeforces Round #268 (Div. 2) ABCD

    CF469 Codeforces Round #268 (Div. 2) http://codeforces.com/contest/469 开学了,时间少,水题就不写题解了,不水的题也不写这么详细了 ...

随机推荐

  1. Flask 之 蓝图

    蓝图,听起来就是一个很宏伟的东西 在Flask中的蓝图 blueprint 也是非常宏伟的 它的作用就是将 功能 与 主服务 分开怎么理解呢? 比如说,你有一个客户管理系统,最开始的时候,只有一个查看 ...

  2. 各种环境下反弹shell

    0x00 NC命令详解 在介绍如何反弹shell之前,先了解相关知识要点. nc全称为netcat,所做的就是在两台电脑之间建立链接,并返回两个数据流 可运行在TCP或者UDP模式,添加参数 -u 则 ...

  3. Azure DevOps (六) 通过FTP上传流水线制品到Linux服务器

    上一篇我们实现了把流水线的制品保存到azure的流水线制品仓库里去,本篇我们会开始研究azure的发布流水线. 本篇要研究的是把流水线仓库的制品发布到任意一台公网的linux服务器上去,所以我们先研究 ...

  4. winform 代码生成textbox ,checkbox

    参考地址:https://jingyan.baidu.com/article/380abd0a6b80701d90192cde.html 首先搭建好Winform项目框架后,创建窗体页面后自行布局 这 ...

  5. javascript函数 (二 定义函数的三种方法)

    javascript定义函数(声明函数)可以有三种方法:正常方法.构造函数.函数直接量 <html><head></head><body> <sc ...

  6. 【vue】中英文切换(使用 vue-i18n )

    一.准备工作 1.vue-i18n 1.仓库地址 2.兼容性:支持 Vue.js 2.x 以上版本 1-1.安装依赖vue-i18n (c)npm install vue-i18n 1-2.使用 在 ...

  7. Linux 下命令有哪几种可使用的通配符?分别代表什么含义?

    "?"可替代单个字符. "*"可替代任意多个字符. 方括号"[charset]"可替代 charset 集中的任何单个字符,如[a-z],[ ...

  8. Struts2里面有什么隐式对象?

    Struts 2.1 的隐式对象 (这些隐式对象都是Map类型) parameters 用于访问请求参数 request 用于访问HttpServletRequest的属性 session 用于访问H ...

  9. @Bean和@Componet区别

    无意在两个类上看到了这两个注解,一个使用了@Bean配合@Configuration,一个使用了@Componet.依稀记得这两个注解都是实现以前在xml中<bean xxx/>的功能,但 ...

  10. SpringBoot 自定义配置文件不会自动提示问题

    参阅:https://www.jianshu.com/p/ec3f0b0371e6