摘要:E - Power Strings Given two strings a and b we define ab to be their concatenation. For example, if a = "abc" and b = "def" then ab = "abcdef". If we
阅读全文
摘要:A - Oulipo The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group.
阅读全文
摘要:https://codeforces.com/contest/1328/problem/E E. Tree Queries You are given a rooted tree consisting of nn vertices numbered from 11 to nn. The root o
阅读全文
摘要:Problem A. Balanced Fighters https://codeforces.com/group/5yyKg9gx7m/contest/273522/problem/B 题目描述: 每2个fighter之间打。问A打赢B,B打赢C,C打赢A的组合有多少个。(输出顺序任意,但每组只能
阅读全文
摘要:J - Largest Rectangle in a Histogram HDU - 1506 题目描述: 一个柱形图,求一个贴着x轴的矩形的最大面积。 分析: 可以看出是从一个点向左和右扩张,只要比i高,都可以作为扩张对象。 所以记录L[i],R[i]为i的左边界和右边界。如果暴力i--记为L,i
阅读全文
摘要:L - Round Numbers POJ - 3252 http://poj.org/problem?id=3252 题目描述: 求l到r里面二进制数0的数量>=1的数量的数,有多少个。 分析: 把数分成二进制数,用数位dp。dp[pos] [num_0] [num_1]表示第pos位0的数量位n
阅读全文
摘要:N - F(x) HDU - 4734 http://acm.hdu.edu.cn/showproblem.php?pid=4734 题目描述: 0~B里面,F(b)<=F(A)的有多少个。 F(x)=A n * 2 n-1 + A n-1 * 2 n-2 + ... + A 2 * 2 + A 1
阅读全文
摘要:Problem F Flipping Coins Here’s a jolly and simple game: line up a row of N identical coins, all with the heads facing down onto the table and the tai
阅读全文
摘要:E. Milk Visits https://codeforces.com/group/5yyKg9gx7m/contest/269717/problem/E 题目描述: 农夫约翰计划建造N(1≤N≤105)个农场,这些农场将通过N-1条道路连接起来,形成一棵树(即,所有农场彼此之间都是可到达的,没
阅读全文
摘要:P - Discovering Gold LightOJ - 1030 https://vjudge.net/contest/349029#problem/P 题目描述: 长为n的山洞,从0出发,每次掷一个6面的色子,得到的点数x。假设当前位置i,如果i+x<=n,就移动到i+x。否则再掷一次。直到
阅读全文
摘要:J - Kejin Player HDU - 6656 https://vjudge.net/contest/349029#problem/J 题目描述: 花费a[i],从i升到i+1级有p[i]的可能成功,失败就掉到x[i]级。问从l升到r级的期望。 分析: dp[i]表示从1级升到i级的期望,如
阅读全文
摘要:F - Dice (III) LightOJ - 1248 题目描述: 掷出有n面的色子的全部面,求他的期望。 分析: 期望dp,假设掷出i面,dp[i]表示掷出i面的期望。每次会掷出2种情况:1.掷出不同的面,转移到i+1面,概率为(n-i)/n。2.掷出相同的,状态还是i面,概率为i/n。 且花
阅读全文
摘要:G. Livestock Lineup https://codeforces.com/group/5yyKg9gx7m/contest/269717/problem/G 题目描述: 有8头牛,给出n条信息,每条信息要求牛X要在牛Y旁边。 再按他们的字典序最小的输出。 分析: 先按字典序把这8头牛用1
阅读全文
摘要:D. Meetings https://codeforces.com/group/5yyKg9gx7m/contest/269717/problem/D 分析: 2头牛相遇看成交换2头牛的质量,方向不变。所以一头牛的终点可以是是固定的,那么离终点最近的就是最早进入仓的。所以他到达仓时的质量是他穿过的
阅读全文
摘要:I. Where Am I? https://codeforces.com/group/5yyKg9gx7m/contest/269717/problem/I 题目描述: 找出一个字符串s中,一串长度为k的字符串a,这个字符串a在s中只有一个。求出最大的k。 分析: 二分k即可。指定k,依次遍历字符
阅读全文
摘要:B. MooBuzz https://codeforces.com/group/5yyKg9gx7m/contest/269717/problem/B 题目描述: 自然数中,跳过3和5的倍数,问第n个数是多少。 分析: 可以找到规律:每15个为一个循环,1~15中跳过3和5倍数,剩下9个数。到下一个
阅读全文
摘要:A. Cow Gymnastics https://codeforces.com/group/5yyKg9gx7m/contest/269717/problem/A 题目描述: 大概意思是,比如下面数据: 4 1 2 3 4 1 3 2 4 2 1 3 从左往右看,如果一个数无论在哪一行都在另一个数
阅读全文
摘要:H. Photoshoot https://codeforces.com/group/5yyKg9gx7m/contest/270203/problem/H 分析: 开始没读懂题。。因为他编号是1~n,不能多不能少。所以从小到暴力即可,只要符合b i=a i+a i+1的要求和编号恰好含1~n。 #
阅读全文
摘要:E. Word Processor https://codeforces.com/group/5yyKg9gx7m/contest/270203/problem/E 分析: (水题)记录长度,到了超过长度就换行。 代码: #include <stdio.h> #include <cstring> #
阅读全文
摘要:D. Race https://codeforces.com/group/5yyKg9gx7m/contest/270203/problem/D 分析: 因为他是每秒增加并以该速度前进的。最后要降到指定的速度以下,而且要刚好走完。可以把他想象成一个梯形,从1一直加到能加的最大值maxs,以maxs速
阅读全文
摘要:B. Loan Repayment https://codeforces.com/group/5yyKg9gx7m/contest/270203/problem/B 分析: 参考大佬题解:https://www.cnblogs.com/BrianPeng/p/12284076.html 首先要二分x
阅读全文
摘要:A. Wormhole Sort https://codeforces.com/group/5yyKg9gx7m/contest/270203/problem/A 分析: 首先可以想到二分w。判断其中一个数x是否符合要求,考虑并查集。把大于x的w放在一个集合。看这个集合中,所有错位母牛的编号和他的位
阅读全文