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. 20180824 SSRS Line Chart 绘制

    (很多时候我都会只记录遇到的问题点,很少详细的写整个过程) 1. 安装ReportBulider 客户端,不需要填写server url ,可以先放空,后面再维护. 安装包官网可以下载,是免费的,现在 ...

  2. vuex 子组件传值

    以下是基础的使用方法,详细且深入使用方法详细见博客:https://segmentfault.com/a/1190000015782272 Vuex官网地址:https://vuex.vuejs.or ...

  3. 8款不错的 CI/CD工具

    Jenkins Jenkins是CI市场中最知名且最常见的名号之一.其最初是由Sun公司的一位工程师打造的一个辅助项目,并迅速扩展为最大的开源CI工具之一,可帮助工程团队实现自动化部署.顺带一提:我们 ...

  4. [LeetCode] 124. Binary Tree Maximum Path Sum_ Hard tag: DFS recursive, Divide and conquer

    Given a non-empty binary tree, find the maximum path sum. For this problem, a path is defined as any ...

  5. Maven中的-D(Properties属性)和-P(Profiles配置文件)

    -D代表(Properties属性) 使用命令行设置属性-D的正确方法是: mvn -DpropertyName=propertyValue clean package 如果propertyName不 ...

  6. python regularexpress

    这个正则表达式,我还真没有接触过,在python首次学习 //test.py 1 import re 2 3 print (re.match('www', 'www.myweb.com').span( ...

  7. Go断后,Dart冲前,Google的野心

    今天,我要讲讲新的前端web语言-Dart 我是网上看到这段话,激起了兴趣,虽然我不能算是真正的web前端从业者!哈哈 [ Dart语言由谷歌制造,用来替代Javascript,弥补Javascrip ...

  8. js中两个!!的理解

    在js中经常有两个!!出现,经常让人难以理解 (function () { var a = 10; var b = 20; function add(num1, num2) { var num1 = ...

  9. rsync+inotify磁盘数据实时同步

    一.rsync+inotify主服务器部署 1.1安装rsync [root@nginx ~]# cd /usr/src/ [root@nginx src]# tar zxvf rsync-3.0.9 ...

  10. caffe-ssd的GPU安装时make runtest报错: BatchReindexLayerTest/3.TestGradient, where TypeParam = caffe::GPUDevice<double>

    报错原因:装了两个cuda,BatchReindexLayerTest/3.TestGradient不能确定用那个 解决办法1:删除其中一个(最好删除9.1,TensorFlow支持的是9.0,为了后 ...