摘要: S1: 被4, 25整除的数, 最后两位一定被4, 25整除. Proof: 被4和25整除的数$I$, 可以看成$\overline{a_na_{n - 1}\cdots a_3pq}$,前面的$\overline{a_na_{n - 1}\cdots a_3}$可以看成$100x$, 因为$4, 阅读全文
posted @ 2023-06-09 10:20 IHOPEIDIEYOUNG 阅读(24) 评论(0) 推荐(0)
摘要: 题目链接:https://ac.nowcoder.com/acm/contest/59457#rank *** AB 纯暴力 C 思维题 从任意情况入手, 设$highbit(x)$为数x的二进制表示最高位, 则容易发现当$highbit(r)$大于$highbit(l)$时, 总能异或出从$hig 阅读全文
posted @ 2023-06-02 06:20 IHOPEIDIEYOUNG 阅读(18) 评论(0) 推荐(0)
摘要: 题目链接: https://ac.nowcoder.com/acm/contest/59275#rank *** A. 枚举不讲 B. 简单二分不讲 C. 暴力是$O(n^2)$的, 用KMP可以直接做到$O(n)$, 贴一下代码 ``` /* Author: SJ */ #include cons 阅读全文
posted @ 2023-05-30 11:21 IHOPEIDIEYOUNG 阅读(35) 评论(0) 推荐(0)
摘要: 资料内容: https://oi-wiki.org/string/kmp/ *** 很久以前学过,写一些笔记作复习资料 一些概念: 真前缀, 真后缀等等不作介绍 (**真前后缀匹配函数**)前缀函数(pi函数): $$ \pi[i] = \max_{k = 0 \dots i}\{k: s[0 \d 阅读全文
posted @ 2023-05-30 11:04 IHOPEIDIEYOUNG 阅读(110) 评论(0) 推荐(0)
摘要: 快速求$1^2 + 2^2 + 3^2 + \dotsb + n^2$模11的余数 *** 我们来证明一下$1^2 + 2^2 + 3^2 + \dotsb + n^2$的通项公式是$\frac{n(n+1)(2n+1)}{6}$, 然后就可以$O(1)$直接算这个式子: Lemma 1: 对于任意 阅读全文
posted @ 2023-05-24 04:30 IHOPEIDIEYOUNG 阅读(45) 评论(0) 推荐(0)
摘要: 题目链接: A https://www.luogu.com.cn/problem/P5831 B https://www.luogu.com.cn/problem/P5832 C https://www.luogu.com.cn/problem/P5832 A 分析: 范围很小, 直接暴力枚举即可, 阅读全文
posted @ 2023-05-15 02:19 IHOPEIDIEYOUNG 阅读(23) 评论(0) 推荐(0)