设为首页 加入收藏

TOP

hdu 1800 Flying to the Mars (map)(暴力)
2015-07-20 18:00:59 来源: 作者: 【 】 浏览:2
Tags:hdu 1800 Flying the Mars map 暴力

map


//输入一堆数字 看一堆数中最少有多少个上升子串(不连续的子串)
//每个串去掉一串最长的 再去掉一串次长的。
//到最后肯定剩下某个出现次数最多的数字? 
//所以本题就是找那个数字出现的最多  最多的次数是多少
//因为数太大数组存不下 所以用map
# include
  
   
# include
    # include
    
      # include 
     
       using namespace std; int main() { int n; __int64 a,max; map<__int64,__int64>q; while(~scanf("%d",&n)) { q.clear(); while(n--) { scanf("%I64d",&a); q[a]++; } map<__int64,__int64>::iterator it; max=0; //it->first 为a,it->second为 q[]++; //iterator->first 关键字(key) //iterator->second 存储的数据(value) for(it=q.begin();it!=q.end();it++) { if(max
      
       second) max=it->second; } printf("%I64d\n",max); } return 0; }
      
     
    
  


暴力


# include 
  
   
# include 
   
     # include 
    
      using namespace std; int main() { int a[3010],flag[3010]; int n,i,min,cot,count; while(~scanf("%d",&n)) { for(i=0;i
     
      min) { min=a[i]; flag[i]=1; count++; } } if(count==n) { printf("%d\n",cot); break; } } } return 0; }
     
    
   
  


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇UVA10716 - Evil Straw Warts Live 下一篇poj 3254 Corn Fields ,状态压缩..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: