A. Towers

题目连接:

http://www.codeforces.com/contest/37/problem/A

Description

Little Vasya has received a young builder’s kit. The kit consists of several wooden bars, the lengths of all of them are known. The bars can be put one on the top of the other if their lengths are the same.

Vasya wants to construct the minimal number of towers from the bars. Help Vasya to use the bars in the best way possible.

Input

The first line contains an integer N (1 ≤ N ≤ 1000) — the number of bars at Vasya’s disposal. The second line contains N space-separated integers li — the lengths of the bars. All the lengths are natural numbers not exceeding 1000.

Output

In one line output two numbers — the height of the largest tower and their total number. Remember that Vasya should use all the bars.

Sample Input

3

1 2 3

Sample Output

1 3

Hint

题意

有n个木棍,如果木棍的长度一样的话,可以把它扔到上面,然后问你最高的是多高,以及有多少种木头

题解:

map,水题直接莽一波

代码

#include<bits/stdc++.h>
using namespace std; map<int,int>H;
int main()
{
int n;
scanf("%d",&n);
int ans=0,ans2=0;
for(int i=1;i<=n;i++)
{
int x;
scanf("%d",&x);
if(H[x]==0)ans2++;
H[x]++;
ans=max(ans,H[x]);
}
cout<<ans<<" "<<ans2<<endl;
}

Codeforces Beta Round #37 A. Towers 水题的更多相关文章

  1. Codeforces Beta Round #2 A. Winner 水题

    A. Winner 题目连接: http://www.codeforces.com/contest/2/problem/A Description The winner of the card gam ...

  2. Codeforces Testing Round #12 A. Divisibility 水题

    A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/probl ...

  3. Codeforces Beta Round #37 C. Old Berland Language 暴力 dfs

    C. Old Berland Language 题目连接: http://www.codeforces.com/contest/37/problem/C Description Berland sci ...

  4. Codeforces Beta Round #37 B. Computer Game 暴力 贪心

    B. Computer Game 题目连接: http://www.codeforces.com/contest/37/problem/B Description Vasya's elder brot ...

  5. Codeforces Beta Round #3 C. Tic-tac-toe 模拟题

    C. Tic-tac-toe 题目连接: http://www.codeforces.com/contest/3/problem/C Description Certainly, everyone i ...

  6. 水题 Codeforces Beta Round #70 (Div. 2) A. Haiku

    题目传送门 /* 水题:三个字符串判断每个是否有相应的元音字母,YES/NO 下午网速巨慢:( */ #include <cstdio> #include <cstring> ...

  7. Codeforces Beta Round #5 B. Center Alignment 模拟题

    B. Center Alignment 题目连接: http://www.codeforces.com/contest/5/problem/B Description Almost every tex ...

  8. Codeforces Beta Round #13 C. Sequence (DP)

    题目大意 给一个数列,长度不超过 5000,每次可以将其中的一个数加 1 或者减 1,问,最少需要多少次操作,才能使得这个数列单调不降 数列中每个数为 -109-109 中的一个数 做法分析 先这样考 ...

  9. Codeforces Beta Round #32 (Div. 2, Codeforces format)

    Codeforces Beta Round #32 (Div. 2, Codeforces format) http://codeforces.com/contest/32 A #include< ...

随机推荐

  1. 【Python项目】简单爬虫批量获取资源网站的下载链接

    简单爬虫批量获取资源网站的下载链接 项目链接:https://github.com/RealIvyWong/GotDownloadURL 1 由来 自己在收集剧集资源的时候,这些网站的下载链接还要手动 ...

  2. DevExpress 行事历(Scheduler)的常用属性、事件和方法

    一.TcxScheduler[TcxScheduler常用属性]1.Storage    - 邦定一个Storage为Scheduler显示提供数据 2.DateNavigate.ColCount   ...

  3. TcxScheduler的使用2

    DevExpress 行事历(Scheduler)的常用属性.事件和方法 参考资料来源:附带的ExpressScheduler 2  Demo, 如想了解更多可以查看Demo. 一.TcxSchedu ...

  4. pom可以过滤resource 下的文件

  5. leetcode刷刷刷

    1.链表节点的插入排序(写了个插入排序,但是报段错误,自己编译器里能运行) #include <iostream> #include <stdlib.h> #include & ...

  6. 通过`__slots__` 节省RAM

    标签(空格分隔): Python进阶 python中,由于创建每个实例都会有成员,这些成员都会被保存在dict中,但是Python不能静态分配RAM,当创建实例时,因此dict的大小会比所需要的内存大 ...

  7. Scrapy的【SitemapSpider】的【官网示例】没有name属性

    Windows 10家庭中文版,Python 3.6.4,Scrapy 1.5.0, 上午看了Scrapy的Spiders官文,并按照其中的SitemapSpider的示例练习,发现官文的示例存在问题 ...

  8. Tango ROS Streamer

    谁想要在Android平台上编写机器人应用,或者谁希望扩展其与室内定位和3D感知新的传感器的机器人开发,Intermodalics创建的ROS Streamer应用的Tango. 这个Android应 ...

  9. Zookeeper原理架构与搭建

    一.Zookeeper到底是什么!? 学一个东西,不搞明白他是什么东西,哪还有心情学啊!! 首先,Zookeeper是Apache的一个java项目,属于Hadoop系统,扮演管理员的角色. 然后看到 ...

  10. CVE-2014-1776 秘狐

    传说中的IE秘狐 [CNNVD]Microsoft Internet Explorer 释放后重用漏洞(CNNVD-201404-530) Microsoft Internet Explorer(IE ...