计数排序
来源:互联网 发布:传媒大数据 编辑:程序博客网 时间:2024/06/04 18:41
计数排序:员工年龄排序
原题在这里:
http://ac.jobdu.com/problem.php?cid=1039&pid=16
#include<stdio.h>
int Counter[100];
int SortEmployee()
{
int Count = 0;
int Index = 0;
int offset = 0;
int Input = 0;
while(scanf("%d",&Count) == 1)
{
offset = 0;
for (Index = 0; Index<100; ++Index)
{
Counter[Index] = 0;
}
for (Index = 0; Index<Count;++Index)
{
scanf("%d",&Input);
++Counter[ Input ];
}
for (Index = 1; Index<100; ++Index)
{
for(int i = 0; i<Counter[Index];++i)
{
//Output[offset++] = Index;
printf("%d ",Index );
}
}
printf("\n");
}
return 0;
}
int main(int argc, char const *argv[])
{
SortEmployee();
return 0;
}
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 计数排序
- 把主框架窗口设置为圆角矩形,并改变外围边框颜色
- linux使用dd命令快速生成大文件
- java_composite
- Java 创建大文件
- 两会瞬间:温家宝三鞠躬 胡锦涛掩面。十年扶持,最美是当初年华,流动逝去。
- 计数排序
- WINRAR实现自动备份
- RTC Eclipse Plug-in Development
- 如何设计一个LRU Cache?
- SAP long text SAP长文本读取。
- 如何获取插入或移除媒体卡事件
- 直接插入排序(Straight Insertion Sort)
- Socket连接
- 获取当前鼠标按键的坐标值,左键输出当前点,右键则删除上一个按键值,中间键退出