上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 23 下一页
摘要: 题目链接:https://codeforces.com/contest/1367/problem/A 题意 给出一个字符串 $t$,找出原字符串 $s$,$t$ 由 $s$ 从左至右的所有长为 $2$ 的子串构成。 题解 只有 $s$ 的首尾字符会只在 $t$ 中出现一次,其余字符都会重复出现两次。 阅读全文
posted @ 2020-06-17 23:10 Kanoon 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 比赛链接:https://atcoder.jp/contests/abc170 A - Five Variables 题意 $5$ 个数中有 $1$ 个 $0$,判断是第几个。 代码 #include <bits/stdc++.h> using namespace std; int main() { 阅读全文
posted @ 2020-06-14 22:35 Kanoon 阅读(412) 评论(0) 推荐(1) 编辑
摘要: 题目链接:https://codeforces.com/contest/1364/problem/C 题意 给出大小为 $n$ 的非递减数组 $a$,构造同样大小的数组 $b$,使得对于每个 $i$,$b_1, b_2, \ldots, b_i$ 中未出现的最小正整数均为 $a_i$ 。($1 \l 阅读全文
posted @ 2020-06-14 19:05 Kanoon 阅读(278) 评论(0) 推荐(1) 编辑
摘要: 题目链接:https://codeforces.com/contest/1364/problem/B 题意 给出大小为 $n$ 的一个排列 $p$,找出子序列 $s$,使得 $|s_1-s_2|+|s_2-s_3|+\ldots+|s_{k-1}-s_k|$ 最大的同时 $k$ 尽可能地小。 题解 阅读全文
posted @ 2020-06-14 17:20 Kanoon 阅读(329) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://codeforces.com/contest/1364/problem/A 题意 找出大小为 $n$ 的数组 $a$ 的最长连续子数组,其元素和不被 $x$ 整除。 题解 如果数组的每个元素都被 $x$ 整除,则不存在不被 $x$ 整除的子数组 如果整个数组之和不被 $x$ 阅读全文
posted @ 2020-06-14 17:10 Kanoon 阅读(398) 评论(0) 推荐(1) 编辑
摘要: 题目链接:https://codeforces.com/contest/1366/problem/C 题意 有一个 $n \times m$ 的 $01$迷宫,要使从 $(1,1)$ 到 $(n,m)$ 的所有路径均为回文串,至少要变换多少字符。 题解一 用 $bfs$ 得到回文串每个位置可能的 $ 阅读全文
posted @ 2020-06-12 11:21 Kanoon 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://codeforces.com/contest/1366/problem/B 题意 大小为 $n$ 的数组 $a$,除了 $a_x = 1$,其余 $a_i = 0$,依次给出 $m$ 个区间,可以选择区间中的两个元素交换(可相同),问最多有多少个元素可能为 $1$ 。 题解 阅读全文
posted @ 2020-06-12 11:19 Kanoon 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://codeforces.com/contest/1366/problem/A 题意 有两个数 $a$ 和 $b$,每次可以选择从一个数中取 $2$,另一个数中取 $1$,问最多可以进行多少次这样的操作。 题解一 比较好想的一种模拟的做法: 较多者每次取两个至二者相等 二者每次 阅读全文
posted @ 2020-06-12 11:15 Kanoon 阅读(369) 评论(0) 推荐(1) 编辑
摘要: 题目链接:https://codeforces.com/problemset/problem/1365/E 题意 有 $n$ 个元素,定义大小为 $k$ 的集合值为 $\sum2^i$,其中,若集合内至少有 $max(1, k - 2)$ 个数二进制下第 $i$ 位为 $1$,则第 $i$ 位有效, 阅读全文
posted @ 2020-06-11 16:00 Kanoon 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 这题犯了一个很严重的错误,bfs 应该在入队操作的同时标记访问,而不是每次只标记取出的队首元素。 题目链接:https://codeforces.com/contest/1365/problem/D 题意 有一个 $n \times m$ 的迷宫,迷宫有四种方格: '.' 空方格 '#' 墙 'B' 阅读全文
posted @ 2020-06-08 01:47 Kanoon 阅读(128) 评论(2) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 23 下一页