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. python3之pymysql模块

    1.python3 MySQL数据库链接模块 PyMySQL 是在 Python3.x 版本中用于连接 MySQL 服务器的一个库,Python2中则使用mysqldb. PyMySQL 遵循 Pyt ...

  2. Python标准库笔记(11) — Operator模块

    Operator--标准功能性操作符接口. 代码中使用迭代器时,有时必须要为一个简单表达式创建函数.有些情况这些函数可以用一个lambda函数实现,但是对于某些操作,根本没必要去写一个新的函数.因此o ...

  3. DRM/KMS 基本组件介绍

    Each DRM device provides access to manage which monitors and displays are currently used and what fr ...

  4. 关于app的cpu占用率想到的几个问题

    1.top 命令获取的cpu是手机瞬间的cpu 2.dumpsys获取的是一段时间cpu的平均值?那么这段时间是指哪段,从哪开始到什么时候结束? 3.如果想测试app某操作下的cpu占用情况时候.应该 ...

  5. 【Android开发日记】之入门篇(十二)——Android组件间的数据传输

    组件我们有了,那么我们缺少一个组件之间传递信息的渠道.利用Intent做载体,这是一个王道的做法.还有呢,可以利用文件系统来做数据共享.也可以使用Application设置全局数据,利用组件来进行控制 ...

  6. 洛谷P2886牛继电器

    传送门啦 倍增 $ Floyd $ 注意结构体里二维数组不能开到 $ 2000 $ #include <iostream> #include <cstdio> #include ...

  7. python_selenium自动化测试框架

    设计思路 本文整理归纳以往的工作中用到的东西,现汇总成基础测试框架提供分享. 框架采用python3 + selenium3 + PO + yaml + ddt + unittest等技术编写成基础测 ...

  8. jenkins Error performing command: git ls-remote -h

    Jenkins新建项目中源码管理使用Git时遇到如下问题: Failed to connect to repository : Error performing command: git ls-rem ...

  9. 适合新手的web开发环境

    学习web开发,环境搭建是必不可少的一个环节.你可以使用wamp一键安装包,或者使用sae.bae.gae这种PaaS平台来部署,或者安装*nix系统在本地部署. 对于一个希望体验LAMP式建站的新手 ...

  10. 第一篇CodeIgniter框架的下载及安装

    初次学习Php,网上搜了很多php框架,最后选择了CodeIgniter. 安装环境:php5+mysql6.5+iis7 我的电脑是用来办公写文档用的,win7系统,不想换系统,所以就安装了win7 ...