题目链接:http://codeforces.com/contest/294/problem/B B. Shaass and Bookshelf time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Shaass has n books. He wants to make a bookshelf for all his books.…
Shaass has n books. He wants to make a bookshelf for all his books. He wants the bookshelf's dimensions to be as small as possible. The thickness of the i-th book is ti and its pages' width is equal to wi. The thickness of each book is either 1 or 2.…
Hard problem 题目链接: http://codeforces.com/contest/706/problem/C Description Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase Engl…
A. Shaass and Oskols 模拟. B. Shaass and Bookshelf 二分厚度. 对于厚度相同的书本,宽度竖着放显然更优. 宽度只有两种,所以枚举其中一种的个数,另一种的个数是单调的. C. Shaass and Lights 考虑一段连续未点亮的灯,显然每次操作都只会将区间长度减一,继而推得长度L的方案数为\(2^{L - 1}\)种. 考虑有若干段Li合并,对于一个区间来说,内部的操作顺序应该是相对不变的,那么就是挖空填即可. 注意判断两端的状态,即考虑1.n的状…
Coloring Trees Problem Description: ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be naughty and color the trees in the park. The trees are numbered with integers from 1 to n fr…
题目链接: http://codeforces.com/problemset/problem/268/E E. Playlist time limit per test 1 secondmemory limit per test 256 megabytes 问题描述 Manao's friends often send him new songs. He never listens to them right away. Instead, he compiles them into a play…
题目链接: http://codeforces.com/contest/464/problem/C J. Substitutes in Number time limit per test 1 secondmemory limit per test 256 megabytes 问题描述 Andrew and Eugene are playing a game. Initially, Andrew has string s, consisting of digits. Eugene sends A…
D. Fox And Jumping 题目连接: http://codeforces.com/contest/510/problem/D Description Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at…
B. Maximum Submatrix 2 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/375/B Description You are given a matrix consisting of digits zero and one, its size is n × m. You are allowed to rearrange its rows. What is…
题目链接: http://codeforces.com/contest/677/problem/D 题意: 让你求最短的从start->...->1->...->2->...->3->...->...->p的最短路径. 题解: 这题dp的阶段性还是很明显的,相同的值得方格为同一个阶段,然后求从阶段1->2->3...->p的阶段图最短路. 初始化所有a[x][y]==1的格子为起始点到(x,y)坐标的距离. 方程式为dp[x1][y1…