补题链接: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. 使用C#将几个Excel文件合并去重分类

    需要将几个Excel表格里面的数据去重,然后将每个站点的数据另存为一张Sheet上. 几个表格如下所示: 实现效果如下所示: 具体实现 需要使用EPPlus操作Excel 安装EPPlus如下所示: ...

  2. js检测数据类型得四种方式

    1.typeof:返回一个字符串,表示操作数的类型. 语法: typeof(变量) //or typeof 变量 示例:     console.log(typeof 2)//number     c ...

  3. 23C新特性:True Cache的介绍

    我们的文章会在微信公众号"Oracle恢复实录"和博客网站"https://www.cnblogs.com/www-htz-pw/" 同步更新 ,欢迎关注收藏, ...

  4. influxdb: unable to parse points 异常解决总结

    转载请注明出处: influxdb 使用过程经常遇到:unable to parse points  的异常:  unable to parse points 是 InfluxDB 抛出的异常,表示无 ...

  5. 关于win11系统修改用户名导致登录进入不了系统的坑

    背景:公司的新电脑,win11系统,开机进入需要注册用户名和密码,在取用户名的时候,手快没注意取了一个中文名,结果这给我后面的工作带来了一个坑,我在用mysqlworkbench进行数据备份,需要对数 ...

  6. Salesforce LWC学习(四十六) 自定义Datatable实现cell onclick功能

    本篇参考:https://developer.salesforce.com/docs/component-library/bundle/lightning-datatable 背景:我们有时会有这种类 ...

  7. DC静态时序分析之时钟篇

    DC静态时序分析之时钟篇博主微信:flm13724054952,不懂的有疑惑的也可以加微信咨询,欢迎大家前来投稿,谢谢! 引言介绍在芯片设计或者FPGA设计里面,根据有无时钟,将电路设计分为时序逻辑电 ...

  8. Vue2.0 学习 第二组 语法模板

    本笔记主要参考菜鸟教程和官方文档编写. 1.文本绑定 一般在dom中用{{}}标时,并且在vue构造体内的data中定义文本内容 <div id="app">    & ...

  9. @Async实现异步任务

    1.@Async是SpringBoot自带的一个执行步任务注解 @EnableAsync // 开启异步 @SpringBootApplication public class Application ...

  10. TCP/IP协议---三次握手和四次挥手

    TCP首部的数据格式 其中, 源端口号和目的端口号各占16位,端口范围1~65535.1024以下为知名端口,1024~65535是供用户使用.源端口,目的端口,源ip,目的ip这四个值唯一确定一个T ...