[HdOJ]1800 Flying to the Mars
2015-02-10 10:34
260 查看
#include <stdio.h> #include <algorithm> using namespace std; int main() { long int a[3010]; int n,i,count,max; while(scanf("%d",&n)!=EOF) { max=1; for(i=0;i<n;i++) { scanf("%ld",&a[i]); } sort(a,a+n); count=1; for(i=0;i<n-1;i++) // 只进行一次循环就可以找出相同数字的个数了 小心越界 { if(a[i]<a[i+1]) { count=1; } else { count++; } max=max>count?max:count; } printf("%d\n",max); } return 0; }
找出相同的数字最多有多少个
相关文章推荐
- HDOJ1800(Flying to the Mars)
- HDOJ 1800 Flying to the Mars 盲目搜索......................so easy...........
- HDOJ 1800 Flying to the Mars hash
- HDOJ 1800 Flying to the Mars 盲目搜索......................so easy...........
- hdoj 1800 Flying to the Mars (字符串哈希函数)
- hdoj 1800 Flying to the Mars 【贪心】
- HDOJ 1800 Flying to the Mars
- hdoj 1800 Flying to the Mars【贪心】
- HDOJ.1800 Flying to the Mars(贪心+map)
- HDOJ1800 Flying to the Mars(贪心,map)
- HDOJ 1800 Flying to the Mars(LIS)
- HDU/HDOJ 1800 Flying to the Mars 搜索
- 【HDOJ】1800 Flying to the Mars
- [HDOJ1800]Flying to the Mars
- HDU/HDOJ 1800 Flying to the Mars 搜索
- hdoj 1800 Flying to the Mars 【动态规划】
- HDOJ-1800 Flying to the Mars(贪心 + 字典树 + BST)
- hdoj 1800 (Flying to the Mars)
- HDOJ1800 Flying to the Mars【Hash】
- hdu 1800 Flying to the Mars map的基本用法