摘要: Problem 给定起点 $(1,1)$ 和终点 $(n,n)$ 和三元组 $(a,b,c)$。可以且仅可以在第一象限活动。对于点 $(x,y)$,如果 $a\le x\le b$ 且 $y\le c$,则经过该点需要单位时间 $2$,反之需要单位时间 $1$。求从起点到终点的最短路程。 link- 阅读全文
posted @ 2022-08-01 14:26 lsj2009 阅读(30) 评论(0) 推荐(0)
摘要: Problem 函数 $f(x)$ 代表 $x$ 的第二大约数。求 $\max\limits_{L\le x\le R}{f(x)}$。 link->https://www.luogu.com.cn/problem/P8219 Solution 如果 $x$ 是偶数的话,那么 $f(x)$ 无疑是 阅读全文
posted @ 2022-08-01 14:24 lsj2009 阅读(23) 评论(0) 推荐(0)
摘要: Problem link->https://www.luogu.com.cn/problem/P8247。 Solution 我们不妨先来考虑,如果神箭游侠处于 $(1,1)$ 点,那么怎样的点 $(a_1,b_1)$ 与 $(a_2,b_2)$ 才能满足他们处于以 $(1,1)$ 为端点的同一条射 阅读全文
posted @ 2022-08-01 14:22 lsj2009 阅读(22) 评论(0) 推荐(0)
摘要: Problem link->https://www.luogu.com.cn/problem/P8248。 Solution 按题意直接构造即可:每次扩展时循环 $1,2,3,4$,判断是否可以添加(循环 $len$ 从 $1$ 到 $\lfloor\frac{i}{2}\rfloor$,判断每个 阅读全文
posted @ 2022-08-01 14:20 lsj2009 阅读(44) 评论(0) 推荐(0)
摘要: Problem 给定字符串 $s$,每次删除最大前缀 $a$ 满足删除后的 $s$ 不包含 $a$,问最终的 $|s|$。 link->https://codeforces.com/contest/1654/problem/B Solution 其实只需要每次删除 $s$ 的首字符即可直至不满足条件 阅读全文
posted @ 2022-08-01 14:18 lsj2009 阅读(31) 评论(0) 推荐(0)
摘要: Problem link->https://www.luogu.com.cn/problem/P8235。 Solution 容易发现,长度为 $n$ 的括号序列使得包含合法括号序列做多的最佳情况是: $$\begin{matrix}\underbrace{\texttt{()()()()..... 阅读全文
posted @ 2022-08-01 14:15 lsj2009 阅读(47) 评论(0) 推荐(0)
摘要: Problem link->https://www.luogu.com.cn/problem/P8251。 Solution 这道题我考场上最后 $10$ 分钟想出正解,然而在考试完后的 $10$ 分钟才打出代码。。。 可以发现,无论什么情况,下标大的二元组总是在下标小的二元组的上面,也就是说,如果 阅读全文
posted @ 2022-08-01 14:12 lsj2009 阅读(30) 评论(0) 推荐(0)
摘要: Problem 给定序列 ${a_n}$,找出一个数对 $(i,j)$ 满足 $i,j\le n$ 且对于任意一个 $1\le k\le n$ 的 $k$ 有 $|a_i-a_k|+|a_k-a_j|=|a_i-a_j|$。如有多解,输出任意一个即可。 link->https://codeforce 阅读全文
posted @ 2022-08-01 14:09 lsj2009 阅读(40) 评论(0) 推荐(0)
摘要: Problem 给定序列 ${a_n}$,求是否有一种顺序依次进行 $n-1$ 次操作(每次将其中一个 $a_i$ 从序列中删去,然后将剩下的每个 $a_j$ 都减去 $a_i$),满足最后留下的数 $=k$。 link->https://codeforces.com/contest/1656/pr 阅读全文
posted @ 2022-08-01 14:07 lsj2009 阅读(35) 评论(0) 推荐(0)
摘要: Problem 给定 $n$ 个区间 $[l_i,r_i]$,找到一个点,使之包含它的区间最多。 link->https://www.luogu.com.cn/problem/P3028 Solution 我们将题目换一种方法来理解:给定 $n$ 个区间 $[l_i,r_i]$ 将其中的每个元素都给 阅读全文
posted @ 2022-08-01 14:04 lsj2009 阅读(32) 评论(0) 推荐(0)
摘要: Problem link->https://www.luogu.com.cn/problem/P8267 Solution 约定的数据分别为 $opt_i,p_i$。 设 $f_{0,x}$ 为 $opt_i=\texttt{L}$ 且 $x\le p_i$ 的 $i$ 的数量。 设 $f_{1,x 阅读全文
posted @ 2022-08-01 14:02 lsj2009 阅读(21) 评论(0) 推荐(0)
摘要: Problem link->https://www.luogu.com.cn/problem/P8268 Solution 在我看来,这是一道递归好题。 我们来考虑怎样查询 $x$ 金属是否能够生产(或者已经有 $x$ 金属): 如果本身就有 $x$ 金属,将 $x$ 金属个数 $-1$,返回 tr 阅读全文
posted @ 2022-08-01 12:15 lsj2009 阅读(29) 评论(0) 推荐(0)
摘要: Problem 给定一个正整数 $n$。 找到 $4$ 个正整数 $a,b,c,d$ 使得 $a+b+c+d=n$ 且 $\gcd(a,b) = \operatorname{lcm}(c,d)$。 如有多组解,输出任意一组即可。 link->https://codeforces.com/contes 阅读全文
posted @ 2022-08-01 12:13 lsj2009 阅读(28) 评论(0) 推荐(0)
摘要: Problem link->https://www.luogu.com.cn/problem/P8284 Solution 在此之前,先让我们看一个显然成立的柿子: $$\gcd(\underbrace{a,a,\cdot\cdot\cdot,a,a}_{\texttt{若干个相同的正整数} a}) 阅读全文
posted @ 2022-08-01 12:11 lsj2009 阅读(16) 评论(0) 推荐(0)
摘要: Problem 给定序列 ${a_n}$,对于每个 $a_i$ 你可以将他变成 $a_i-1$ 或 $a_i$ 或 $a_i+1$,是否有一种操作方法可以使该序列满足对于任意一个 $i(1<i\le n)$ 满足 $a_i=a_{i-1}+1$。 link->https://codeforces.c 阅读全文
posted @ 2022-08-01 12:09 lsj2009 阅读(29) 评论(0) 推荐(0)
摘要: Problem 给定一字符串 $s$,问是否有对于一个 $s$ 的子串 $t$ 而言,对于有 $a$ 在 $t$ 中的出现次数与 $b$ 在 $t$ 中的出现次数之差大于 $1$,其中 $a,b\in s$。 link->https://codeforces.com/contest/1673/pro 阅读全文
posted @ 2022-08-01 12:07 lsj2009 阅读(30) 评论(0) 推荐(0)
摘要: Problem 给定字符串 $a$ 和 $b$,其中 $a$ 有且仅有字符 a,我们可以用 $b$ 替换 $a$ 中若干个字符 a(包括替换上的 $b$ 的字符也可以),问最终可能会有几种字符串 $a$?如有无数种,输出 -1。 link->https://codeforces.com/contes 阅读全文
posted @ 2022-08-01 12:06 lsj2009 阅读(44) 评论(0) 推荐(0)
摘要: Problem 给定一个字符串 $s$,你可以从该字符串开头删除若干个字符(可能为 $0$),再从结尾删除若干个字符(可能为 $0$),两次删除的代价总和为两次删除的字符串中 $1$ 的总个数和完成两次删除后的字符串剩余的 $0$ 的个数中的较大值。 link->https://codeforces 阅读全文
posted @ 2022-08-01 12:03 lsj2009 阅读(33) 评论(0) 推荐(0)
摘要: Problem 给定一个 $n$,要求找出三个自然数 $a,b,c$ 满足 $(a\oplus b)+(b\oplus c)+(a\oplus c)=n$。 link->https://codeforces.com/contest/1699/problem/A Solution 又是 CF 经典诈骗 阅读全文
posted @ 2022-08-01 12:00 lsj2009 阅读(31) 评论(0) 推荐(0)
摘要: Problem 给定序列 ${a_n}$,$V(s)$ 表示若 $s$ 在二进制表示下从右到左地 $i$ 位为 $1$,则将 $V(s)$ 异或上 $a_i$。 求 $\bigoplus\limits_{i=0}^{2^n-1} V(i)\times i$。 link->https://www.lu 阅读全文
posted @ 2022-08-01 11:57 lsj2009 阅读(47) 评论(0) 推荐(0)