UVA - 10474 Where is the Marble?
来源:互联网 发布:海岛奇兵医师数据 编辑:程序博客网 时间:2024/06/06 02:55
UVA - 10474 Where is the Marble?
题目大意:给出一组数字和一组问题,将数字按升序排列后,求每个问题第一次出现的位置。
解题思路:所见即所得,和题目大意一致。
#include<cstdio>#include<cstring>#include<algorithm>int main() { int c=0, n, q, num[10005],que[10005]; while( scanf("%d%d",&n,&q),n||q) { memset( num , 0 ,sizeof(num)); memset( que , 0 ,sizeof(que)); c++; int i; for( i = 0; i < n; i++) scanf("%d",&num[i]); for( i = 0; i < q; i++) scanf("%d",&que[i]); std::sort( num, num + n); printf("CASE# %d:\n",c); for(int j = 0; j < q ; j++ ) { for( i = 0; i < n ; i++ ) { if( que[j] == num[i] ) { printf("%d found at %d\n",que[j],i+1); break; } } if( i==n) printf("%d not found\n",que[j]); } } return 0;}
0 0
- 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
- 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
- up
- UVA - 375 Inscribed Circles and Isosceles Triangles
- Android集成支付宝
- UVA - 10420 List of Conquests
- UVA - 340 Master-Mind Hints
- UVA - 10474 Where is the Marble?
- UVA - 152 Tree's a Crowd
- HEI
- 微信支付
- Strange Way to Express Integers--扩展欧几里得和中国剩余定理
- K-means聚类方法 - Andrew Ng笔记的翻译及理解
- 接入微信的流程,不官方,赞
- Android学习之AutoCompleteTextView和MultiAutoCompleteTextView
- URAL 1519 Formula 1 dp(插头)