设为首页 加入收藏

TOP

uva10474大理石在哪儿where is the marble?
2015-07-20 17:20:59 来源: 作者: 【 】 浏览:2
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

评论

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

·C 内存管理 | 菜鸟教 (2025-12-26 20:20:37)
·如何在 C 语言函数中 (2025-12-26 20:20:34)
·国际音标 [ç] (2025-12-26 20:20:31)
·微服务 Spring Boot (2025-12-26 18:20:10)
·如何调整 Redis 内存 (2025-12-26 18:20:07)