设为首页 加入收藏

TOP

uva10474大理石在哪儿where is the marble?
2015-07-20 17:20:59 来源: 作者: 【 】 浏览:3
Tags:uva10474 大理石 哪儿 where the marble

背景:做了这么久的题,唯一一道一次ac的,可见这道题是如何的简单。

思路:思路很清楚的模拟题,先排序再查找。

学习:sort函数和lower_bound函数,sort函数排序就不多说了,lower_bound函数作用是查找一个数组中大于等于x的第一个位置。

#include 
  
   
#include 
   
     #include 
    
      using namespace std; int figue[10000]; void print(int n,int b) { for(int i=0;i
     
      b) {printf("%d not found\n",b);return;} } printf("%d not found\n",b); return; } int main(void) { int N,Q,k,game=1; while(cin>>N>>Q&&N&&Q) { printf("CASE# %d:\n",game++); for(int i=0;i
      
       >figue[i]; sort(figue,figue+N); while(Q--) { cin>>k; print(N,k); } } return 0; } 
      
     
    
   
  

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇(hdu step 2.3.6)Game of Connect.. 下一篇[LeetCode]62.Unique Paths

评论

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

·Redis on AWS:Elast (2025-12-27 04:19:30)
·在 Spring Boot 项目 (2025-12-27 04:19:27)
·使用华为开发者空间 (2025-12-27 04:19:24)
·Getting Started wit (2025-12-27 03:49:24)
·Ubuntu 上最好用的中 (2025-12-27 03:49:20)