Educational Codeforces Round 148 [Rated for Div. 2]A~C
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的更多相关文章
- 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 ...
- 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 ...
- Educational Codeforces Round 43 (Rated for Div. 2)
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...
- Educational Codeforces Round 35 (Rated for Div. 2)
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...
- 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 ...
- 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 ...
- Educational Codeforces Round 63 (Rated for Div. 2) 题解
Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...
- 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 < ...
- Educational Codeforces Round 48 (Rated for Div. 2) CD题解
Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforce ...
- Educational Codeforces Round 60 (Rated for Div. 2) 题解
Educational Codeforces Round 60 (Rated for Div. 2) 题目链接:https://codeforces.com/contest/1117 A. Best ...
随机推荐
- Python爬虫突破验证码技巧 - 2Captcha
在互联网世界中,验证码作为一种防止机器人访问的工具,是爬虫最常遇到的阻碍.验证码的类型众多,从简单的数字.字母验证码,到复杂的图像识别验证码,再到更为高级的交互式验证码,每一种都有其独特的识别方法和应 ...
- ISP图像处理—紫边Purple Fringing
图像紫边存在数码相机.监控摄像头等数字成像图像,使用设备在逆光.大光圈条件下拍摄图像的高反差区域容易出现紫边,解决图像自编问题有助设备得到完美图像. 紫边成因分析和确定有助与紫边消除的图像处理算法研究 ...
- Hexo博客yilia主题首页添加helper-live2d模型插件
插件效果 插件的github地址 插件作者提供了较为详细的安装步骤,我结合自己操作和图示,提供大家. 效果展示:红框内为2d模型,可以随鼠标移动而变化 安装模块: hexo博客根目录选择cmd命令窗口 ...
- RAT蓝队自动化测试框架
RAT蓝队自动化测试框架 介绍 RAT 是根据 MITRE ATT&CK 战术矩阵测试蓝队检测能力的脚本框架,由 python2.7 编写,共有 50 多种不同 ATT&CK 技术点和 ...
- React报错:Module not found: Error: Can't resolve 'react-router-dom'
解决方案 npm install -S react-router-dom@5 参考链接 https://stackoverflow.com/questions/53914013/failed-to-c ...
- 笔记:KMP的复习
Record 一个重要的字符串算法,这是第三次复习. 通过总结我认为之所以某个算法总是忘记,是因为大脑始终没有认可这种算法的逻辑(也就是脑回路). 本篇主要讲解从KMP的应用场景,再到算法知识,以及例 ...
- spring-mvc 系列:视图(ThymeleafView、InternalResourceView、RedirectView)
目录 一.ThymeleafView 二.转发视图 三.重定向视图 四.视图控制器view-controller 五.配置jsp解析 SpringMVC中的视图是View接口,视图的作用渲染数据,将模 ...
- Win10安装Oracle-21C
1.前期工作 下载安装包:OracleXE213_Win64.zip 解压安装包 2.开始安装 注意:以管理员身份运行 ++++++++++++++++++++++分割线+++++++++++++++ ...
- OpenSSH版本升级漏洞修复问题
Hi, I'm @Merbelue 大家好,这篇为大家介绍二进制方式对OpenSSH版本升级,在生产环境中可用于解决版本升级.漏洞修复等. @ 目录 1.环境 2.安装telnet 2.1.检查是否安 ...
- 【io_uring】简介和使用
文章目录 简介 使用 系统调用 liburing 样例 代码流程 编译 参考资料 简介 io_uring 是 Linux 在 5.1 版本引入的一套新的异步 IO 实现.相比 Linux 在 2.6 ...