Codeforces Beta Round #37 A. Towers 水题
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 水题的更多相关文章
- Codeforces Beta Round #2 A. Winner 水题
A. Winner 题目连接: http://www.codeforces.com/contest/2/problem/A Description The winner of the card gam ...
- Codeforces Testing Round #12 A. Divisibility 水题
A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/probl ...
- Codeforces Beta Round #37 C. Old Berland Language 暴力 dfs
C. Old Berland Language 题目连接: http://www.codeforces.com/contest/37/problem/C Description Berland sci ...
- Codeforces Beta Round #37 B. Computer Game 暴力 贪心
B. Computer Game 题目连接: http://www.codeforces.com/contest/37/problem/B Description Vasya's elder brot ...
- Codeforces Beta Round #3 C. Tic-tac-toe 模拟题
C. Tic-tac-toe 题目连接: http://www.codeforces.com/contest/3/problem/C Description Certainly, everyone i ...
- 水题 Codeforces Beta Round #70 (Div. 2) A. Haiku
题目传送门 /* 水题:三个字符串判断每个是否有相应的元音字母,YES/NO 下午网速巨慢:( */ #include <cstdio> #include <cstring> ...
- Codeforces Beta Round #5 B. Center Alignment 模拟题
B. Center Alignment 题目连接: http://www.codeforces.com/contest/5/problem/B Description Almost every tex ...
- Codeforces Beta Round #13 C. Sequence (DP)
题目大意 给一个数列,长度不超过 5000,每次可以将其中的一个数加 1 或者减 1,问,最少需要多少次操作,才能使得这个数列单调不降 数列中每个数为 -109-109 中的一个数 做法分析 先这样考 ...
- Codeforces Beta Round #32 (Div. 2, Codeforces format)
Codeforces Beta Round #32 (Div. 2, Codeforces format) http://codeforces.com/contest/32 A #include< ...
随机推荐
- aarch64_l3
librdmacm-utils-1.1.0-4.fc26.aarch64.rpm 2017-02-12 07:12 87K fedora Mirroring Project libreadline-j ...
- ### mysql系统结构_3_Mysql_Learning_Notes
mysql系统结构_3_Mysql_Learning_Notes 存储层,内存结构 全局(buferpool) 只分配一次 全局共享 连接/会话(session) 针对每个会话/线程分配 按需动态分配 ...
- java浅复制与深手动构造实现
首先来看看浅拷贝和深拷贝的定义: 浅拷贝:使用一个已知实例对新创建实例的成员变量逐个赋值,这个方式被称为浅拷贝. 深拷贝:当一个类的拷贝构造方法,不仅要复制对象的所有非引用成员变量值,还要为引用类型的 ...
- 十分钟搞懂快速傅里叶变换(FFT)
己学习的笔记,欢迎大家指正.
- MySQL -- SQL 语句
一. 数据库(Database)操作 创建数据库 create database 数据库名 create database 数据库名 character set 字符集 查看数据库 查看数据库服务器中 ...
- pyquery学习笔记
很早就听说了pyquery的强大.写了个简单的测试程序实验下. 思路是找个动态网页,先用PhantomJS加载,然后用PYQUERY解析. 1.随便找了个带表格的股票网页,里面有大量的股票数据,测试的 ...
- 手淘移动适配方案flexible.js兼容bug处理
什么是flexible.js 移动端自适应方案 https://www.jianshu.com/p/04efb4a1d2f8 什么是rem 这个单位代表根元素的 font-size 大小(例如 元素的 ...
- 列表CListCtrl类使用
CListCtrl是列表控件类,列表控件的每一行叫做一个item,每一列叫做一个subitem.每一行和每一列都有个ID号,可以确定唯一的单元格. 最近使用了这个控件,有心得总结如下: (Dialog ...
- JS图片滚动代码(无缝、平滑)
非常平滑的JS图片滚动特效代码,无缝循环,速度可自定义,鼠标悬停时停止.它的特点是JS和图片地址分离,这样做你就经易的从数据库动态调用每张图片的地址,方便控制,因此它非常的应用. <!DOCTY ...
- python os 用法(转)
注:转自这里,仅作为方便个人查询使用 获取文件所在路径 import os os.path.dirname(__file__) 获取当前文件的所在路径 print (os.path.dirname( ...