补题链接:Here

Proble-A. Strange Table

根据 x 确定坐标确定的行数和列数。

int main() {
ios_base::sync_with_stdio(false), cin.tie(0);
int _;
for (cin >> _; _--;) {
ll n, m, x;
cin >> n >> m >> x;
x--;
ll col = x / n, row = x % n;
cout << row * m + col + 1 << "\n";
}
return 0;
}

Problem-B. Partial Replacement

题意:n组样例,每组单走一个字符串s,s由‘*’和‘.’组成,可以把'*'号变成‘X'号,但是需要满足,首尾的‘.’号要变成‘X’号,相邻'X'距离不能超过k。求最终X个数最小值。

长度很小,直接暴搜,找到*号之后,下一个位置从x+k开始倒着找,找到最后直接返回,这样肯定是最小的了。

int main() {
ios_base::sync_with_stdio(false), cin.tie(0);
int _;
for (cin >> _; _--;) {
int n, k;
string s;
cin >> n >> k >> s;
int cnt = 1;
int i = s.find_first_of('*'); while (true) {
int j = min(n - 1, i + k);
for (; i < j and s[j] == '.'; --j)
;
if (i == j) break;
i = j, cnt++;
}
cout << cnt << "\n";
}
return 0;
}

Problem-C. Double-ended Strings

两个字符串不大,可暴力

int main() {
ios_base::sync_with_stdio(false), cin.tie(0);
int _;
for (cin >> _; _--;) {
string a, b;
cin >> a >> b;
int cnt = 0;
int n = a.size(), m = b.size();
for (int len = 1; len <= min(n, m); ++len) {
for (int i = 0; i + len <= n; ++i)
for (int j = 0; j + len <= m; ++j)
if (a.substr(i, len) == b.substr(j, len))
cnt = max(cnt, len);
}
cout << n + m - 2 * cnt << '\n';
}
return 0;
}

Problem-D. Epic Transformation

这里要用一下优先队列去模拟消除的过程。

int main() {
ios_base::sync_with_stdio(false), cin.tie(0);
int _;
for (cin >> _; _--;) {
int n, x;
cin >> n;
map<int, int> mp;
priority_queue<pair<int, int>> q;
for (int i = 0; i < n; ++i) {
cin >> x;
mp[x]++;
}
for (auto [x, y] : mp) q.push({y, x});
int Size = n;
while (q.size() >= 2) {
auto [cnt1, x1] = q.top();
q.pop();
auto [cnt2, x2] = q.top();
q.pop();
cnt1--, cnt2--, Size -= 2;
if (cnt1) q.push({cnt1, x1});
if (cnt2) q.push({cnt2, x2});
}
cout << Size << "\n";
}
return 0;
}

Problem-E. Restoring the Permutation

E题待补...

Codeforces Round #710 (Div. 3)个人简单题解的更多相关文章

  1. Codeforces Round #612 (Div. 2) 前四题题解

    这场比赛的出题人挺有意思,全部magic成了青色. 还有题目中的图片特别有趣. 晚上没打,开virtual contest打的,就会前三道,我太菜了. 最后看着题解补了第四道. 比赛传送门 A. An ...

  2. Codeforces Round #198 (Div. 2)A,B题解

    Codeforces Round #198 (Div. 2) 昨天看到奋斗群的群赛,好奇的去做了一下, 大概花了3个小时Ak,我大概可以退役了吧 那下面来稍微总结一下 A. The Wall Iahu ...

  3. Codeforces Round #672 (Div. 2) A - C1题解

    [Codeforces Round #672 (Div. 2) A - C1 ] 题目链接# A. Cubes Sorting 思路: " If Wheatley needs more th ...

  4. Codeforces Round #599 (Div. 2)的简单题题解

    难题不会啊…… 我感觉写这个的原因就是因为……无聊要给大家翻译题面 A. Maximum Square 简单题意: 有$n$条长为$a_i$,宽为1的木板,现在你可以随便抽几个拼在一起,然后你要从这一 ...

  5. Codeforces Round #614 (Div. 2) A-E简要题解

    链接:https://codeforces.com/contest/1293 A. ConneR and the A.R.C. Markland-N 题意:略 思路:上下枚举1000次扫一遍,比较一下 ...

  6. Codeforces Round #610 (Div. 2) A-E简要题解

    contest链接: https://codeforces.com/contest/1282 A. Temporarily unavailable 题意: 给一个区间L,R通有网络,有个点x,在x+r ...

  7. Codeforces Round #310 (Div. 2)--A(简单题)

    http://codeforces.com/problemset/problem/556/A 题意:给一个01字符串,把所有相邻的0和1去掉,问还剩下几个0和1. 题解:统计所有的0有多少个,1有多少 ...

  8. Codeforces Round #198 (Div. 2)C,D题解

    接着是C,D的题解 C. Tourist Problem Iahub is a big fan of tourists. He wants to become a tourist himself, s ...

  9. Codeforces Round #619 (Div. 2) A~D题解

    最近网课也开始了,牛客上一堆比赛题目也没补,所以就D题后面的也懒得补了 A.Three String 水题 #include <cstdio> #include <cstring&g ...

  10. Codeforces Round #611 (Div. 3) A-F简要题解

    contest链接:https://codeforces.com/contest/1283 A. Minutes Before the New Year 题意:给一个当前时间,输出离第二天差多少分钟 ...

随机推荐

  1. MySQL锁粒度是什么意思?MySQL锁粒度是什么?

    MySQL锁粒度就是我们通常所说的锁级别.数据库引擎具有多粒度锁定,允许一个事务锁定不同类型的资源. MySQL数据库有三种锁的级别,分别是:页级锁.表级锁 .行级锁. 锁粒度 锁粒度就是我们通常所说 ...

  2. 老是听到做PPT要会“内容可视化”,到底啥是内容可视化?

    在PPT中,内容可视化是指将文字.数据和概念等抽象信息转化为图像.图表.图表及其他可视化元素来呈现.通过合适的颜色.形状.大小和布局等视觉设计元素来强调信息的关键点和关系, 从而提高观众对信息的理解和 ...

  3. Markdown语法入门与进阶指南

    一.Markdown简介 Markdown是一种轻量级标记语言,创始人为约翰·格鲁伯(john Gruber).它允许人们使用易读易写的纯文本格式编写文档,然后转换成有效的XHTML(或者HTML)文 ...

  4. serdes 复制时钟

    serdes复制时钟一般指的是,将rx lane的CDR 恢复时钟发送给TX/PLL, 这样rx和tx的时钟频偏就一致,在远端环回时经常用到.RX,TX时钟同频后环回数据就可以畅通发出去,否则RX/T ...

  5. [ABC274F] Fishing

    Problem Statement On a number line, there are $N$ fish swimming. Fish $i$, which has a weight of $W_ ...

  6. hbase报错 ERROR: org.apache.hadoop.hbase.ipc.ServerNotRunningYetException: Server is not running yet

    hbase报错:hbase shell能打开 网页也能打开 但是一执行命令就开始报错. 原因:hadoop的安全模式打开. 解决方法:关闭安全模式 ,再重新启动HBase就可以了. 具体的命令: 1. ...

  7. 组合式api-侦听器watch的语法

    和vue2对比,也是语法上稍有不同. 监听单个数据对象 <script setup> import {ref, watch} from "vue"; const cou ...

  8. MagicArray基本使用方法

    MagicArray致力于让研发不再卷,这个灵感来源于php语言,可能多少年以后,php可能不会有太多人记得.但是在一个年代里,如果论坛里里常见最火爆的帖子无疑是:php是世界上最好的编程语言.由此可 ...

  9. IDM HOSTS本地注册 屏蔽的网址

    127.0.0.1 registeridm.com127.0.0.1 www.registeridm.com127.0.0.1 www.internetdownloadmanager.com127.0 ...

  10. kubernetes安装(一)

    参考: https://www.cnblogs.com/liuyangQAQ/p/17299871.html 部署组件包 名称 安装包 kubeadm集群组件 kubelet-1.20.9 kubea ...