codeforce 651B Beautiful Paintings
题意:后一个比前一个大就加一,问最大次数。
#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的更多相关文章
- codeforces 651B Beautiful Paintings
B. Beautiful Paintings time limit per test 1 second memory limit per test 256 megabytes input standa ...
- CodeForces 651B Beautiful Paintings 贪心
A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input o ...
- Codeforces 651B Beautiful Paintings【贪心】
题意: 给定序列,重新排序,使严格上升的子序列最多.求这些子序列总长度. 分析: 贪心,统计每个元素出现次数,每次从剩余的小的开始抽到大的,直到不再剩余元素. 代码: #include<iost ...
- codeforces 651B B. Beautiful Paintings
B. Beautiful Paintings time limit per test 1 second memory limit per test 256 megabytes input standa ...
- Codeforces Round #345 (Div. 2) B. Beautiful Paintings 暴力
B. Beautiful Paintings 题目连接: http://www.codeforces.com/contest/651/problem/B Description There are n ...
- Codeforces 651 B. Beautiful Paintings
B. Beautiful Paintings time limit per test 1 second memory limit per test 256 megabytes input stan ...
- 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 ...
- 【CodeForces 651B】Beautiful Paintings 排序+贪心
题目大意: 给定集合,对于任意一个的排列,记,求. 很明显每次搞出一个长度为的最长上升序列,然后把元素给删掉,答案增加. 直接暴力需要. 但是可以进行优化. 设有个,将个数从小到大排序,记为长度为的数 ...
- Beautiful Paintings CodeForces - 651B (贪心)
大意: 给定序列$a$, 可以任意排序, 求最大下标i的个数, 满足$a_i<a_{i+1}$. 这个贪心挺好的, 答案就为n-所有数字出现次数最大值.
随机推荐
- java 调用oracle 分页存储过程 返回游标数据集
1.分页类 package org.zh.basic; /** * 页面类 * * @author keven * */ public class PageInfo { // 定义 private S ...
- python3 中自带urllib库可下载图片到本地
刚从python3下载图片的语句python2的不太一样,具体python3语句如下: form urllib import request jpg_link = '......' #图片链接 re ...
- 补充:学会Twitter Bootstrap不再难
博客园的兄弟姐妹们很给力,自从这篇文章写出后,有人可能会对2.x版本升级到3.x版本的区别有些好奇和模糊.现在将官方给出的说明贴上去: 从2.x升级到3.0版本 Bootstrap 3并不向后兼容Bo ...
- <一> ASP.NET Html 表单
把客户端数据发送到服务器端用<form>标签 htmlpage.html Default2.aspx.cs
- AppExtention - today
声明: 本文转自王巍 WWDC 2014 Session笔记 - iOS 通知中心扩展制作入门 本文是我的 WWDC 2014 笔记 中的一篇,涉及的 Session 有 Creating Exten ...
- c++ 联合体
联合体分配的内存大小是成员变量中最大变量的大小 联合体的成员变量共享内存 小段模式(X86就是) 低位数据存在低地址单元 大端模式 高位字节存在低地址单元
- Oracle客户端PL_SQL的安装
Oracle数据库的操作大多还是在客户端完成的,因此在众多的客户端软件中我选择了PL_SQL,一下谈谈PL_SQL的基本安装和操作,以及在操作中碰到的一些问题: 1. 首先下载PL_SQL客户端软件, ...
- Matlab实现K-Means聚类算法
人生如戏!!!! 一.理论准备 聚类算法,不是分类算法.分类算法是给一个数据,然后判断这个数据属于已分好的类中的具体哪一类.聚类算法是给一大堆原始数据,然后通过算法将其中具有相似特征的数据聚为一类. ...
- [转载]常用Web Service汇总(天气预报、时刻表等)
下面总结了一些常用的Web Service,是平时乱逛时收集的,希望对大家有用. ============================================ 天气预报Web Servic ...
- SQL Server 索引结构及其使用(一)
转载:SQL Server 索引结构及其使用(一) 作者:freedk 一.深入浅出理解索引结构 实际上,您可以把索引理解为一种特殊的目录.微软的SQL SERVER提供了两种索引:聚集索引(clus ...