CF127B.Canvas Frames
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Nicholas, a painter is going to paint several new canvases. Nicholas is sure that the canvases will turn out so great that each one will need framing and being hung on the wall. Frames are what Nicholas decided to begin with.
Nicholas has n sticks whose lengths equal _a_1, _a_2, ... a__n. Nicholas does not want to break the sticks or glue them together. To make a h × w-sized frame, he needs two sticks whose lengths equal h and two sticks whose lengths equal w. Specifically, to make a square frame (when h = w), he needs four sticks of the same length.
Now Nicholas wants to make from the sticks that he has as many frames as possible; to be able to paint as many canvases as possible to fill the frames. Help him in this uneasy task. Note that it is not necessary to use all the sticks Nicholas has.
尼古拉斯是一位画家,他准备绘制若干幅新画作。尼古拉斯确信这些画作将非常出色,以至于每幅都需要装框并悬挂在墙上。因此,他决定先从制作画框开始。
尼古拉斯有 n 根木棍,其长度分别为 a1,a2,…,an。他既不想锯断木棍,也不想将木棍粘合在一起。要制作一个尺寸为 h×w 的画框,他需要两根长度为 h 的木棍和两根长度为 w 的木棍。特别地,当制作正方形画框(即 h=w)时,他需要四根长度相同的木棍。
现在,尼古拉斯希望利用手中现有的木棍尽可能多地制作画框,从而能绘制尽可能多的画作来填满这些画框。请帮助他完成这项艰巨的任务。注意:不必使用尼古拉斯拥有的全部木棍。
输入格式
The first line contains an integer n (1 ≤ n ≤ 100) — the number of sticks. The second line contains n space-separated integers. The i-th integer equals the length of the i-th stick a__i (1 ≤ a__i ≤ 100).
第一行包含一个整数 n(1≤n≤100)—— 表示木棍的数量。
第二行包含 n 个以空格分隔的整数。其中第 i 个整数表示第 i 根木棍的长度 ai(1≤ai≤100)。
输出格式
Print the single number — the maximum number of frames Nicholas can make for his future canvases.
输出单个数字——尼古拉斯能为其未来画布制作的最大画框数量。
输入输出样例
输入#1
5 2 4 3 2 3
输出#1
1
输入#2
13 2 2 4 4 4 4 6 6 6 7 7 9 9
输出#2
3
输入#3
4 3 3 3 5
输出#3
0
输入解题思路,AI测评打分。不知道怎么写?