A

#include <bits/stdc++.h>

using namespace std;
typedef long long LL;
const int N = 60;
char c[N]; void run()
{
scanf("%s", c + 1);
int n = strlen(c + 1);
map<char, int>st;
st[c[1]] ++;
for(int i = 2; i <= n / 2; ++ i)
{
if(st.find(c[i]) == st.end())
{
printf("YES\n");
return;
}
}
printf("NO\n");
} int main()
{
// freopen("1.in", "r", stdin);
int t;cin >> t;
while(t --) run();
return 0;
}

B

直接枚举即可

#include <bits/stdc++.h>

using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
int a[N];
LL s[N]; void run()
{
int n, k;
scanf("%d%d", &n, &k);
for(int i = 1; i <= n; ++ i) scanf("%d", &a[i]);
sort(a + 1, a + 1 + n);
for(int i = 1; i <= n; ++ i) s[i] = s[i - 1] + a[i];
LL ans = 0;
for(int i = 0; i <= k; ++ i)
{
int l = 2 * (k - i), r = n - i;
ans = max(ans, s[r] - s[l]);
}
printf("%lld\n", ans);
} int main()
{
// freopen("1.in", "r", stdin);
int t;cin >> t;
while(t --) run();
return 0;
}

C

C比赛时没出,思路上没什么大问题,就是差一点(bushi,说到底还是自己菜)

我们可以发现这道题只需要找一下有多少个波峰和波谷就可以了,因为波峰波谷一定不能删除

#include <bits/stdc++.h>

using namespace std;
typedef long long LL;
const int N = 3e5 + 10; void run()
{
int n;
scanf("%d", &n);
vector<int>a(n);
for(int i = 0; i < n; ++ i) scanf("%d", &a[i]);
n = unique(a.begin(), a.end()) - a.begin();
int ans = 0;
for(int i = 0; i < n; ++ i)
{
if(i == 0 || i == n -1 || a[i] > a[i - 1] == a[i] > a[i + 1]) ans ++;
}
printf("%d\n", ans);
} int main()
{
// freopen("1.in", "r", stdin);
int t;cin >> t;
while(t --) run();
return 0;
}

Educational Codeforces Round 148 [Rated for Div. 2]A~C的更多相关文章

  1. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  2. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

  3. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

  4. Educational Codeforces Round 35 (Rated for Div. 2)

    Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...

  5. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...

  6. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...

  7. Educational Codeforces Round 63 (Rated for Div. 2) 题解

    Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...

  8. Educational Codeforces Round 39 (Rated for Div. 2) G

    Educational Codeforces Round 39 (Rated for Div. 2) G 题意: 给一个序列\(a_i(1 <= a_i <= 10^{9}),2 < ...

  9. Educational Codeforces Round 48 (Rated for Div. 2) CD题解

    Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforce ...

  10. Educational Codeforces Round 60 (Rated for Div. 2) 题解

    Educational Codeforces Round 60 (Rated for Div. 2) 题目链接:https://codeforces.com/contest/1117 A. Best ...

随机推荐

  1. Pycharm里Python运行窗口显示乱码���的解决方法

    当你的Python程序运行后,会在运行窗口中显示乱码 ��� 等字样,如下 原因是 Pycharm中默认设置只显示UTF-8编码的格式,需要修改支持显示中文支持. 解决方法: 菜单中选择 File S ...

  2. vue3中使用defineExpose报TS-2339

    开头先把错误贴上 src/hooks/usePageSearch.ts:9:27 TS2339: Property 'getPageData' does not exist on type '{ $: ...

  3. 瞬间抠图!揭秘 ZEGO 绿幕抠图算法背后的技术

    抠图是图像处理中最常见的操作之一,指的是将图像中需要的部分从画面中精确的提取出来. 抠图的主要功能是为了后期的合成做准备.在 Photoshop 中,抠图的方法有很多种,最常见的有通道抠图.蒙版抠图. ...

  4. iphone拍照的历史顽固问题-鬼影

    iphone11 系列的鬼影问题 近期苹果 iPhone 11 系列的手机又出现了新问题,其中有不少网友表示,自己在用手机拍照后,图片中莫名出现了"鬼影"的现象,这次的" ...

  5. 2022级HAUT新生周赛题解汇总

    2022级HAUT新生周赛(零)题解@:前六题题解  G题比赛模拟题目题解 2022级HAUT新生周赛(一)题解@卞子骏:题解 2022级HAUT新生周赛(二)题解@武其轩:题解  题解2 2022级 ...

  6. OpenApi(Swagger)快速转换成 TypeScript 代码 - STC

    在现代的 Web 开发中,使用 OpenAPI(以前称为 Swagger)规范来描述和定义 API 已经成为一种常见的做法.OpenAPI 规范提供了一种统一的方式来描述API的结构.请求和响应,使得 ...

  7. 【RocketMQ】消息的存储总结

    当Broker收到生产者的消息发送请求时,会对请求进行处理,从请求中解析发送的消息数据,接下来以单个消息的接收为例,看一下消息的接收过程. 数据校验 封装消息 首先Broker会创建一个Message ...

  8. ETL之apache hop系列3-hop Server环境部署与客户端发布管道工作流

    前言 该文档主要是apache hop 2.5的 Windows 10和Linux docker环境部署和客户端发布工作流和管道的相关内容 不使用Docker直接使用应用程序包,下载压缩包文件后,需要 ...

  9. Go 并发编程 - 并发安全(二)

    什么是并发安全 并发情况下,多个线程或协程会同时操作同一个资源,例如变量.数据结构.文件等.如果不保证并发安全,就可能导致数据竞争.脏读.脏写.死锁.活锁.饥饿等一系列并发问题,产生重大的安全隐患,比 ...

  10. minio 支持object搜索方案

    minio支持上传时对object打标签,查询时可以根据标签做筛选.但是有ftp上传文件的需求,导致无法给object打标签.并且也不清楚minio对于根据标签的筛选性能如何,因此我们打算将objec ...