A. Olympiad

题目链接:http://codeforces.com/problemset/problem/937/A

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

The recent All-Berland Olympiad in Informatics featured n participants with each scoring a certain amount of points.

As the head of the programming committee, you are to determine the set of participants to be awarded with diplomas with respect to the following criteria:

  • At least one participant should get a diploma.
  • None of those with score equal to zero should get awarded.
  • When someone is awarded, all participants with score not less than his score should also be awarded.

Determine the number of ways to choose a subset of participants that will receive the diplomas.

Input

The first line contains a single integer n (1 ≤ n ≤ 100) — the number of participants.

The next line contains a sequence of n integers a1, a2, ..., an (0 ≤ ai ≤ 600) — participants' scores.

It's guaranteed that at least one participant has non-zero score.

Output

Print a single integer — the desired number of ways.

Examples
Input

Copy
4
1 3 3 2
Output
3
Input

Copy
3
1 1 1
Output
1
Input

Copy
4
42 0 0 42
Output
1
Note

There are three ways to choose a subset in sample case one.

  1. Only participants with 3 points will get diplomas.
  2. Participants with 2 or 3 points will get diplomas.
  3. Everyone will get a diploma!

The only option in sample case two is to award everyone.

Note that in sample case three participants with zero scores cannot get anything.

题解:取重 排除 0

 #include <iostream>
#include <algorithm>
#include <set>
using namespace std;
int a[];
int main()
{
int n;
set<int> s;
while(cin>>n){
s.clear();
int x;
for(int i=;i<n;i++){
cin>>a[i];
s.insert(a[i]);
}
int sum=s.size();
sort(a,a+n);
if(a[]==) sum--;
cout<<sum<<endl;
}
return ;
}

Codeforces 937A - Olympiad的更多相关文章

  1. CodeForces 222D - Olympiad

    第一行给出两个个数字k和n,第二三行分别有k个数字,求将第二.三行之间的数字相互组合,求最多有多少个组合的和不小于n 纯粹暴力 #include <iostream> #include & ...

  2. Codeforces 最大流 费用流

    这套题目做完后,一定要反复的看! 代码经常出现的几个问题: 本机测试超时: 1.init函数忘记写. 2.addedge函数写成add函数. 3.边连错了. 代码TLE: 1.前向星边数组开小. 2. ...

  3. Codeforces Round #306 (Div. 2) B. Preparing Olympiad dfs

    B. Preparing Olympiad Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550 ...

  4. DFS Codeforces Round #306 (Div. 2) B. Preparing Olympiad

    题目传送门 /* DFS: 排序后一个一个出发往后找,找到>r为止,比赛写了return : */ #include <cstdio> #include <iostream&g ...

  5. Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics)

    A. Even Subset Sum Problem 题意 给出一串数,找到其中的一些数使得他们的和为偶数 题解 水题,找到一个偶数或者两个奇数就好了 代码 #include<iostream& ...

  6. codeforces B - Preparing Olympiad(dfs或者状态压缩枚举)

    B. Preparing Olympiad You have n problems. You have estimated the difficulty of the i-th one as inte ...

  7. Codeforces Round #347 (Div. 2) C. International Olympiad 找规律

    题目链接: http://codeforces.com/contest/664/problem/C 题解: 这题最关键的规律在于一位的有1989-1998(9-8),两位的有1999-2098(99- ...

  8. Codeforces Round #441 (Div. 2, by Moscow Team Olympiad) D. Sorting the Coins

    http://codeforces.com/contest/876/problem/D 题意: 最开始有一串全部由"O"组成的字符串,现在给出n个数字,指的是每次把位置n上的&qu ...

  9. Codeforces Round #441 (Div. 2, by Moscow Team Olympiad) C. Classroom Watch

    http://codeforces.com/contest/876/problem/C 题意: 现在有一个数n,它是由一个数x加上x每一位的数字得到的,现在给出n,要求找出符合条件的每一个x. 思路: ...

随机推荐

  1. 自定义UIProgressView

    自定义CustomporgressView #import <UIKit/UIKit.h> @interface CustomporgressView : UIView @property ...

  2. SQL Server 安装好后 Always On群组配置

    需要对SQL Server必要的端口打开Windows防火墙的入站规则,比如TCP- 1433端口等. 特别注意:由于AG默认需要用到TCP-5022端口,所以该端口务必保证在Windows防火墙中开 ...

  3. DevExpress换肤

    procedure TForm1.cxComboBox1PropertiesChange(Sender: TObject); begin // 这个地方必须是UserSkin,不然不会起作用 dxSk ...

  4. 多线程2.md

    # 多线程  VS 多进程 - 程序:一堆代码以文本形式存入一个文档 - 进程: 程序运行的一个状态 - 包含地址空间.内存.数据栈等 - 每个进程由自己完全独立的运行环境,多进程共享数据是一个问题 ...

  5. [django]python异步神器-celery

    python异步神器celery https://segmentfault.com/a/1190000007780963

  6. docker machine 使用教程

    之前,Docker的安装流程非常复杂,用户需要登录到相应的主机上,根据官方的安装和配置指南来安装Docker,并且不同的操作系统的安装步骤也是不一样的.而有了Machine后,不管是在笔记本.虚拟机还 ...

  7. 读书笔记_Effective C++_条款一:将C++视为一个语言联邦

    C++起源于C,最初的名称为C with Classes,意为带类的C语言,然而,随着C++的不断发展和壮大,在很多功能上已经远远超越了C,甚至一些C++程序员反过来看C代码会觉得不习惯. C++可以 ...

  8. gitlab4.0->5.0->6.0->7.14->8.0->8.2升级

    参考官方文档: https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/update 本地服务器为4.0.1版本  1)4.0.1->4. ...

  9. 大数据-05-Spark之读写HBase数据

    本文主要来自于 http://dblab.xmu.edu.cn/blog/1316-2/ 谢谢原作者 准备工作一:创建一个HBase表 这里依然是以student表为例进行演示.这里假设你已经成功安装 ...

  10. Mongo数据两表关联创建视图示例

    表tblCard: {"cNo":"11","oRDate":ISODate("2017-08-01T00:00:00.000+0 ...