Codeforces 651 B. Beautiful Paintings】的更多相关文章

B. Beautiful Paintings   time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n pictures delivered for the new exhibition. The i-th painting has beauty ai. We know that a visitor becom…
B. Beautiful Paintings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n pictures delivered for the new exhibition. The i-th painting has beauty ai. We know that a visitor becomes…
题目大意: 给定集合,对于任意一个的排列,记,求. 很明显每次搞出一个长度为的最长上升序列,然后把元素给删掉,答案增加. 直接暴力需要. 但是可以进行优化. 设有个,将个数从小到大排序,记为长度为的数组. 则答案为 于是可以优化到. #include <cstdio> #include <cctype> #include <algorithm> using namespace std; const int T=1001; int n; int a[T],len; inl…
B. Beautiful Paintings 题目连接: http://www.codeforces.com/contest/651/problem/B Description There are n pictures delivered for the new exhibition. The i-th painting has beauty ai. We know that a visitor becomes happy every time he passes from a painting…
B. Beautiful Paintings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n pictures delivered for the new exhibition. The i-th painting has beauty ai. We know that a visitor becomes…
B. Beautiful Paintings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n pictures delivered for the new exhibition. The i-th painting has beauty ai. We know that a visitor becomes…
[codeforces 55]D. Beautiful numbers 试题描述 Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if and only if it is divisible by each of its nonzero digits. We will not argue with this and…
A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at…
大意: 给定序列$a$, 可以任意排序, 求最大下标i的个数, 满足$a_i<a_{i+1}$. 这个贪心挺好的, 答案就为n-所有数字出现次数最大值.…
题意: 给定序列,重新排序,使严格上升的子序列最多.求这些子序列总长度. 分析: 贪心,统计每个元素出现次数,每次从剩余的小的开始抽到大的,直到不再剩余元素. 代码: #include<iostream> #include<algorithm> using namespace std; const int maxn = 1005; int a[maxn]; int m[maxn]; int main (void) { int n;cin>>n; for(int i =…