Codeforces Round #497 (Div. 2) C. Reorder the Array
http://codeforces.com/contest/1008/problems
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MAXN=1e5+10;
const int INF=0x3f3f3f3f;
int a[MAXN];
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
sort(a+1,a+1+n);
int j=1,cnt=0;
for(int i=1;i<=n;i++)
{
if(a[i]>a[j])
{
cnt++;
j++;
}
}
cout<<cnt<<endl;
//cout << "Hello world!" << endl;
return 0;
}
Codeforces Round #497 (Div. 2) C. Reorder the Array的更多相关文章
- Codeforces Round #497 (Div. 2)
Codeforces Round #497 (Div. 2) https://codeforces.com/contest/1008 A #include<bits/stdc++.h> u ...
- Codeforces Round #497 (Div. 2)B. Turn the Rectangles
Bryce1010模板 http://codeforces.com/contest/1008/problems #include <bits/stdc++.h> using namespa ...
- Codeforces Round #497 (Div. 2) A. Romaji
Bryce1010模板 http://codeforces.com/contest/1008/problems #include <bits/stdc++.h> using namespa ...
- Codeforces Round #179 (Div. 1) A. Greg and Array 离线区间修改
A. Greg and Array Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/295/pro ...
- Codeforces Round #331 (Div. 2) B. Wilbur and Array 水题
B. Wilbur and Array Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/596/p ...
- Codeforces Round #258 (Div. 2) B. Sort the Array
题目链接:http://codeforces.com/contest/451/problem/B 思路:首先找下降段的个数,假设下降段是大于等于2的,那么就直接输出no,假设下降段的个数为1,那么就把 ...
- Codeforces Round #510 (Div. 2) D. Petya and Array(离散化+反向树状数组)
http://codeforces.com/contest/1042/problem/D 题意 给一个数组n个元素,求有多少个连续的子序列的和<t (1<=n<=200000,abs ...
- Codeforces Round #374 (Div. 2) D. Maxim and Array 贪心
D. Maxim and Array 题目连接: http://codeforces.com/contest/721/problem/D Description Recently Maxim has ...
- Codeforces Round #373 (Div. 2) E. Sasha and Array 线段树维护矩阵
E. Sasha and Array 题目连接: http://codeforces.com/contest/719/problem/E Description Sasha has an array ...
随机推荐
- Android wifi 从连接态自动断开的解决办法(dhcp导致)【转】
本文转载自:http://blog.csdn.net/DKBDKBDKB/article/details/38490201 对wifi部分的代码流程已经看了段时间,前两天终于解决了工作中遇到的一个wi ...
- 基于BASYS2的VHDL程序——数字钟(最终版)
转载请注明原地址:http://www.cnblogs.com/connorzx/p/3674178.html 调时电路正常工作.一切正常.发现做FPGA还是得从数电的思路思考,设置一个预置使能端,预 ...
- centos6.5 mysql 5.6修改root密码,以及创建用户并授权
mkdir -p mysql_home/{data,temp,undologs,logs} chown -R mysql:mysql /dbfiles/mysql_home mysql_install ...
- codeforces B. Polo the Penguin and Matrix 解题报告
题目链接:http://codeforces.com/problemset/problem/289/B 题目意思:给出一个 n 行 m 列的矩阵和数值 d .通过对矩阵里面的数进行 + d 或者 - ...
- servlet与jsp理论知识讲解
servlet是java服务器端编程,是运行在服务器上的.不同于以前的java小程序. ...
- eclipse 卡死设置
都说eclipse比myeclipse小巧,但是 殊不知 用起来这么这么的卡,最后查资料,才知道是 配置给他的内存太 太小了,怪不得 他一直想着罢工呢. 在eclipse.ini文件中原来的配置如下: ...
- WebRTC GitHub repo developer's guide
WebRTC GitHub repo developer's guide https://github.com/LingyuCoder/SkyRTC-demo WebRTC GitHub repo ...
- 记SCOI2017
Day1完挂,OI再见. 居然卡进去了. UESTC的评测机见鬼啊,我本地不到1s.时限是3s的两道题都T了,然后就少了50pt. Day1 T1看完首先O(n^2)DP是裸的,然后感觉n选k好像不能 ...
- .net网站部署时错误——未能加载文件或程序集(Could not load file or assembly)——的解决
Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKe ...
- linear_classifier.py
import numpy as np from cs231n.classifiers.linear_svm import * from cs231n.classifiers.softmax impor ...