UVA 11987 Where is the Marble? [排序水题]
来源:互联网 发布:软件测试过程模型 编辑:程序博客网 时间:2024/06/06 07:51
题目传送门
不知道什么时候做的排序水题,感觉还挺有趣的。
#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>#include<cmath>using namespace std;int a[10005],m,n,cas,ans;inline long long read(){ static char ch;long long flag=1,res; while((ch=getchar())<'0'||ch>'9')if(ch=='-')flag=-1;res=ch-48; while((ch=getchar())>='0'&&ch<='9')res=res*10+ch-48; return res*=flag;}int main(){ while(scanf("%d%d",&m,&n)!=EOF){ if(m==0&&n==0)break; printf("CASE# %d:\n",++cas); memset(a,0,sizeof(a)); for(register int i=0;i<m;i++) ++a[read()]; for(register int t,i=0;i<n;i++){ t=read(),ans=0; if(a[t] == 0)printf("%d not found\n",t); else{ for(register int i=0;i<t;i++)ans+=a[i]; printf("%d found at %d\n",t,ans + 1); } } } return 0;}
阅读全文
0 0
- UVA 11987 Where is the Marble? [排序水题]
- Where is the Marble? uva 计数排序
- UVa Where is the Marble?
- Where is the Marble? UVA
- Where is the Marble? UVA
- Where is the Marble? UVA
- uva 10474 Where is the Marble?(计数排序)
- uva 10474 Where is the Marble? 计数排序
- uva 10474 - Where is the Marble?(排序,二分搜索)
- UVA 10474 (暑假-排序、检索 -C - Where is the Marble?)
- uva 10474 Where is the Marble?(排序)
- UVa 10474 - Where is the Marble?【排序和检索】
- Uva 10474 Where is the Marble?(排序与检索)
- UVA.10474 Where is the Marble ( 排序 二分查找 )
- UVA - 10474 Where is the Marble?(STL,水)
- uva 10474 Where is the Marble?(简单题)
- 【每日一题(17)】Where is the Marble? UVA
- UVa 10474 Where is the Marble?
- git在android studio上简单的使用
- MyBatis拦截器分页
- 170709 逆向-CISCN总结
- http响应没有body的几种原因
- KAFKA介绍(分布式架构)
- UVA 11987 Where is the Marble? [排序水题]
- Linux下的RPM及YUM详解
- mycat的入门教程(一)
- Mac下PyCharm快捷键大全
- mysql insert 返回自增长主键问题
- js中几种实用的跨域方法原理详解
- thinkphp 在一个页面里设置了cookie只能当前页获取,其他页面获取不了
- Spring@Autowired注解与自动装配
- win2008实际开发用nginx环境,经常出现phpcgi断开