A8321 | Canvas Frames
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
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$ ).
输出格式
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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted