UVA-10470- Where is the Marble?
来源:互联网 发布:摄像机采集软件 编辑:程序博客网 时间:2024/05/29 15:27
今天看我的google阅读器发现怎么我最近更新的博客那么少,以看才知道,原来都在草稿箱里啊::
悲剧啊;
这是一个很简单的题目,就是输出x在A中排第几小或输出没有x.
先输入数x的时候,把a[x]++;那样,输出结束后,a[x]是几,那么就有几个X;
#include<stdio.h>
#include<string.h>
int main()
{
int m,n,x,i,sum,cas=0;
int a[10001],b[10001];
while(scanf("%d%d",&m,&n)&&(m||n))
{
cas++;
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
for(i=0;i<m;i++)
{
scanf("%d",&x);
a[x]++;
}
sum=0;
for(i=0;i<10001;i++)
{
if(a[i])
{
b[i]=sum;
sum+=a[i];
}
}
printf("CASE# %d:\n",cas);
for(i=0;i<n;i++)
{
scanf("%d",&x);
if(a[x])
printf("%d found at %d\n",x,b[x]+1);
else
printf("%d not found\n",x);
}
}
return 0;
}
- UVA-10470- Where is the Marble?
- 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 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?
- UVa 10474 - Where is the Marble
- UVa 10474 - Where is the Marble?
- UVA 10474 Where is the Marble?
- UVA 10474 - Where is the Marble
- Android4.0.3 显示系统深入理解 .
- FindBin模块在文件嵌套时的返回值
- Perl脚本包含多个BEGIN及END块
- 在NS2.33下安装和使用tcl-debug-2.0
- Shell生成随机数
- UVA-10470- Where is the Marble?
- 如何查看Shell函数定义
- 数字与undef进行比较
- 第一篇BLOG给全新的自己
- UVA-152- Tree's a Crowd
- iOS里的MVC
- 使用libxml2库设置encoding的问题
- Linux服务器无法解析域名
- uva-299 - Train Swapping