zoj 2250 - Grandpa is Famous
来源:互联网 发布:javascript 清空数组 编辑:程序博客网 时间:2024/05/18 02:58
题目:统计排名第二的人。
分析:计数排序+统计。
说明:大黄都说题目木有问题。他怎么会放在DP分类里啊。(2011-11-01 15:19)
#include <iostream>#include <cstdlib>#include <cstring>#include <stdio.h>usingnamespace std;int V[ 10005 ];int C[ 10005 ];int cmp( constvoid* a, constvoid* b ){ return *(int *)b - *(int *)a;}int main(){ int N,M,I; while ( cin >> N >> M && (N||M) ) { memset( V, 0, sizeof( V ) ); memset( C, 0, sizeof( C ) ); for ( int i = 1 ; i <= N ; ++ i ) { for ( int j = 1 ; j <= M ; ++ j ) { scanf("%d",&I); ++ C[ I ]; ++ V[ I ]; } } qsort( C, 10001, sizeof( int ), cmp ); int v = 0; for ( int i = 1 ; ; ++ i ) { if ( C[ i ] != C[ i-1 ] ) { v = C[ i ]; break; } } if ( !v ) continue; for ( int i = 1 ; i <= 10000 ; ++ i ) { if ( V[ i ] == v ) { printf("%d ",i); } } printf("\n"); } return 0;}
0 0
- zoj 2250 - Grandpa is Famous
- Grandpa is Famous (P2092)
- poj 2092 Grandpa is Famous
- POJ,2092,Grandpa is Famous
- POJ 2092 Grandpa is famous
- poj 2092 Grandpa is Famous
- hdu 1347 Grandpa is Famous
- HDU 1347 Grandpa is Famous
- hdu 1347 Grandpa is Famous
- HDU 1347 Grandpa is Famous
- POJ 2092 Grandpa is Famous(模拟)
- POJ 2092 Grandpa is Famous (sort排序)
- Grandpa is Famous(poj2092排序)
- POJ 2092 Grandpa is Famous 水
- 杭电OJ题 1347 Grandpa is Famous解题报告
- POJ 2092 Grandpa is Famous【水---找出现第二多的数】
- (使用STL自带的排序功能进行排序7.3.2)POJ 2092 Grandpa is Famous(结构体排序)
- 【水题】poj2092Grandpa is famous
- C/C++语言void及void指针深层探索
- listview的某个item选中后,条目颜色不消失。(实现方法一)
- 笔试、面试重点总结:WIN32、MFC与Linux
- 李亚鹏离婚前写给王菲的信疯传 内容矛盾
- 生成dll文件以及python对DLL中函数的调用(参数类型以及返回值)
- zoj 2250 - Grandpa is Famous
- 51单片机驱动VS1003(模拟spi/自带SPI)
- PB程序设计-创建窗口实例
- Linux常用命令大全
- java bloclqueue
- 打印 Log
- 只为逼格?超薄便携式无线充电设备Deuce
- Hibernate关联关系映射之一对一关联关系
- error RC2108: expected numerical dialog constant