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< ...
随机推荐
- linux键盘input_event浅析【转】
转自:http://blog.csdn.net/tdstds/article/details/18710965 input_event(mxckbd_dev, EV_KEY, mxckpd_keyco ...
- MVVM模式View和ViewModel的通信
还需要些什么呢 在前面几篇博客中我们尝试去实现了MVVM中的数据绑定.命令绑定和事件绑定.貌似实现的差不多了.我最早尝试用MVVM去开发的时候也是这么想的,没有用第三方框架,甚至只是实现了数据绑定和命 ...
- c++ 类的构造顺序
在单继承的情况下,父类构造先于子类,子类析构先于父类,例: class A { public: A() { cout << "A" << endl; } ~ ...
- [NOI2007]货币兑换 「CDQ分治实现斜率优化」
首先每次买卖一定是在某天 $k$ 以当时的最大收入买入,再到第 $i$ 天卖出,那么易得方程: $$f_i = \max \{\frac{A_iRate_kf_k}{A_kRate_k + B_k} ...
- poj1056
简单题 #include <iostream> #include <string> using namespace std; struct cnode { cnode *pze ...
- linux文件处理
取中间的行数作为train.txt sed -n '1000000,170910580p' train.txt > trainv1.txt 取前面的行数作为dev.txt head -10000 ...
- Apache Lucene版本迁移指南
http://lucene.apache.org/core/4_0_0/MIGRATE.html 本文详细介绍了lucene的版本升级过程中的重大改进与调整. 比如:灵活的索引改变了低水平的域.词.文 ...
- python之uinttest,用例执行顺序
unittest单元测试框架, 以test开头的测试用例,默认执行顺序是按照ASC码来执行 如果有类,先排序执行类,在执行类中,再排序用例顺序执行 如果想要按照指定的顺序执行测试用例. 那么就需要用到 ...
- 20155225 2016-2017-2 《Java程序设计》第十周学习总结
20155225 2016-2017-2 <Java程序设计>第十周学习总结 教材学习内容总结 22章网络 22.1网络概览 22.2超文本传输协议(HTTP) 22.2.1 HTTP请求 ...
- Java字符串常见实例与函数
字符串比较 字符串函数 compareTo (string) ,compareToIgnoreCase(String) 及 compareTo(object string) 来比较两个字符串,并返回字 ...