题意:后一个比前一个大就加一,问最大次数。

 #include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<string>
#include<cmath>
#include<vector>
using namespace std;
const int maxn=1e5+;
const double eps=1e-;
const double pi=acos(-);
const int inf = 0x3f3f3f3f;
#define ll long long
#define clc(a,b) memset(a,b,sizeof(a)) int main()
{
int n;
scanf("%d",&n);
int a[];
clc(a,);
for(int i=;i<n;i++)
{
int x;
scanf("%d",&x);
a[x]++;
}
int maxx=-inf;
for(int i=;i<=;i++)
{
if(maxx<a[i])
maxx=a[i];
}
printf("%d\n",n-maxx);
return ;
}

codeforce 651B Beautiful Paintings的更多相关文章

  1. codeforces 651B Beautiful Paintings

    B. Beautiful Paintings time limit per test 1 second memory limit per test 256 megabytes input standa ...

  2. CodeForces 651B Beautiful Paintings 贪心

    A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  3. Codeforces 651B Beautiful Paintings【贪心】

    题意: 给定序列,重新排序,使严格上升的子序列最多.求这些子序列总长度. 分析: 贪心,统计每个元素出现次数,每次从剩余的小的开始抽到大的,直到不再剩余元素. 代码: #include<iost ...

  4. codeforces 651B B. Beautiful Paintings

    B. Beautiful Paintings time limit per test 1 second memory limit per test 256 megabytes input standa ...

  5. Codeforces Round #345 (Div. 2) B. Beautiful Paintings 暴力

    B. Beautiful Paintings 题目连接: http://www.codeforces.com/contest/651/problem/B Description There are n ...

  6. Codeforces 651 B. Beautiful Paintings

    B. Beautiful Paintings   time limit per test 1 second memory limit per test 256 megabytes input stan ...

  7. Codeforces Round #345 (Div. 2)——B. Beautiful Paintings(贪心求上升序列个数)

    B. Beautiful Paintings time limit per test 1 second memory limit per test 256 megabytes input standa ...

  8. 【CodeForces 651B】Beautiful Paintings 排序+贪心

    题目大意: 给定集合,对于任意一个的排列,记,求. 很明显每次搞出一个长度为的最长上升序列,然后把元素给删掉,答案增加. 直接暴力需要. 但是可以进行优化. 设有个,将个数从小到大排序,记为长度为的数 ...

  9. Beautiful Paintings CodeForces - 651B (贪心)

    大意: 给定序列$a$, 可以任意排序, 求最大下标i的个数, 满足$a_i<a_{i+1}$. 这个贪心挺好的, 答案就为n-所有数字出现次数最大值.

随机推荐

  1. dataTable 禁止分页

    $("#id").DataTable({ "paging": false, // 禁止分页 });

  2. Centos系统mysql 忘记root用户的密码

    Centos系统mysql 忘记root用户的密码: 第一步:(停掉正在运行的mysql) [root@maomao ~]# /etc/init.d/mysqld stop Stopping MySQ ...

  3. cx_Oracle ORA-24315: 非法的属性类型的解决办法

    网上查找原因说: 出现该错误的原因是因为版本不兼容. 检查了一下python版本和oracle 的版本,我的oracle client是10g的,python的版本是2.7, 但我安装的cx_orac ...

  4. Python 知识点

    1. generator #g is a generator and g is iterable g = (x*x for x in range(5)) for n in g: print(n) # ...

  5. 随机产生字母a--z, A-Z 的任意组合

    VERSION 1.0    引自: http://www.coderanch.com/t/134491/Security/generating-secure-tokens package demo; ...

  6. oracle学习之-----操作表中的数据

    1. 向表中添加数据(Insert 语句): 添加的语法: INSERT INTO table_name(column1,column2,column3,......) VALUES(value1,v ...

  7. Cloud Test 单页面即时监测功能上线!

    什么是即时监测? 即时监测,顾名思义是指输入 URL 后能够立即进行监测并展示结果,无需注册. 如下图,在输入框内输入需要监测的 URL,点击免费监测,即可展示网页监测结果: 图中我们可以看到页面各个 ...

  8. Delphi GDI+基本用法总结

    GDI+以前只是听说过,还没怎么用过,这段时间用了用,觉得挺好用的.在这里总结一下.留个备忘. GDI+(Graphics Device Interface plus)是Windows XP中的一个子 ...

  9. Yii 实现restful

    首先做一下接口的 URL 规划,假设我们要面对的资源是 item ,现在我们暴露5个接口供其他应用调用,分别是: 对于所有 item 列表调用: GET /rest/item 对于某个 item 信息 ...

  10. ActionBar官方教程(9)ActionBar的顶部tab模式(注意,已经被弃用)

    This interface is deprecated.Action bar navigation modes are deprecated and not supported by inline ...