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. Nacos+OpenFegin正确调用服务的姿势!

    Nacos 支持两种 HTTP 服务请求,一个是 REST Template,另一个是 Feign Client.之前的文章咱们介绍过 Rest Template 的调用方式,主要是通过 Ribbon ...

  2. [SPDK/NVMe存储技术分析]012 - 用户态ibv_post_send()源码分析

    OFA定义了一组标准的Verbs,并提供了一个标准库libibvers.在用户态实现NVMe over RDMA的Host(i.e. Initiator)和Target, 少不了要跟OFA定义的Ver ...

  3. grafana初级入门

    grafana初级入门 预备知识 Metrics.Tracing和Logging的区别 监控.链路追踪及日志作为实时监测系统运行状况,这三个领域都有对应的工具和解决方案. Metrics 监控指标的定 ...

  4. 【flareon6】 overlong-通过动调改内存修改程序

    程序分析 无壳,32位程序 运行后结果 程序比较简单一共三个函数 根据题目和运行结果可以看出来是a3太小了,没法完全解密密钥 解决该问题可以通过写脚本或动调解决 方法一:动调改内存 定位到a3入栈的位 ...

  5. 记-Windows环境下Prometheus+alertmanager+windows_exporter+mtail监控部署

    1.概述 最近因项目需要统计服务的负载情况及机器的负载情况,但是项目里面却没有相关统计而服务所在的机器也没有相关的监控,因为工期原因就选择了相对轻量级的prometheus方案.其中windows_e ...

  6. Canvas将图片转换成base64形式展示的常见问题及解决方案

    导航1:https://blog.csdn.net/weixin_30668887/article/details/98822699 导航2:https://stackoverflow.com/que ...

  7. 什么是 NetflixFeign?它的优点是什么?

    Feign 是受到 Retrofit,JAXRS-2.0 和 WebSocket 启发的 java 客户端联编程序.Feign 的第一个目标是将约束分母的复杂性统一到 http apis,而不考虑其稳定 ...

  8. 如何通过sql语句完成分页?

    oracle select rownum,bookId from [rownum是伪列名,bookId是列名] (select rownum row_id,bookId from xiaoWJ_boo ...

  9. switch 是否能作用在byte 上,是否能作用在long 上,是否能作用在String上?

    答:在Java 5以前,switch(expr)中,expr只能是byte.short.char.int.从Java 5开始,Java中引入了枚举类型,expr也可以是enum类型,从Java 7开始 ...

  10. 请解释Spring Bean的生命周期?

    首先说一下Servlet的生命周期:实例化,初始init,接收请求service,销毁destroy: Spring上下文中的Bean生命周期也类似,如下: (1)实例化Bean: 对于BeanFac ...