链接 [https://ac.nowcoder.com/acm/contest/624/G] 题意 其实题意说的辣鸡死了,没有说明确. y is the subsequences that its sum is strictly less than p, regardless of the length. y是什么这里就没有讲清楚,还让别人猜.浪费我生命 y就是子序列和不大于p的所有子序列长度之和. 分析 首先就是前缀和, 后面每次从第i个开始到最后一个找子序列之和等于或大于p的位置,就可以求出…
这个专栏开始介绍一些<ACM国际大学生程序设计竞赛题解>上的竞赛题目,读者可以配合zju/poj/uva的在线测评系统提交代码(今天zoj貌似崩了). 其实看书名也能看出来这本书的思路,就是一本题解书,简单暴力的通过题目的堆叠来提升解决编程问题的能力. 那么下面开始探索吧. poj1037: Description Background For years, computer scientists have been trying to find efficient solutions to…
问题描述 第14届中北大学程序设计竞赛来了,集训队新买了一大堆气球,气球一共有K种颜色(1<=K<=256),气球的颜色从1-K编号. ZBT童心未泯,他发明了一种摆放气球的游戏,规则如下. 一排有N个桌子,每张桌子上只有一个气球插孔,即每张桌子最多只能放一个气球.编号分别为1-N(1<=N<=100000),每张桌子一开始是空的.现在对这张桌子要进行M次操作(1<=M<=100000),操作的种类一共有2种. 操作1: 操作指令格式: CHANGE L R C 操作含…
Pku 1143: Description Christine and Matt are playing an exciting game they just invented: the Number Game. The rules of this game are as follows. The players take turns choosing integers greater than 1. First, Christine chooses a number, then Matt ch…
pku 1107: Description Weird Wally's Wireless Widgets, Inc. manufactures an eclectic assortment of small, wireless, network capable devices, ranging from dog collars, to pencils, to fishing bobbers. All these devices have very small memories. Encrypti…
Poj1068: Description Let S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses before the ith right parenthesis in S (P-seque…