UVa-10474-Where is the Marble?
来源:互联网 发布:mysql exist的用法 编辑:程序博客网 时间:2024/04/30 09:05
AOAPC I: Beginning Algorithm Contests (Rujia Liu) :: Volume 1. Elementary Problem Solving ::Sorting/Searching
// 10474 - Where is the Marble?#include <iostream>#include <cstdlib>using namespace std; int cmp(const void* a, const void* b){ if( *(int*)a < *(int*)b ) return -1; if( *(int*)a == *(int*)b ) return 0; if( *(int*)a > *(int*)b ) return 1;} int main(void){ int N, Q, n, q, i, x, cnt=1; int a[10000]; // Total no of test cases is less than 65! while(cin>>N>>Q && N!=0) { for(n=1; n<=N; n++) cin >> a[n]; qsort(a+1, N, sizeof(int), cmp); cout << "CASE# " << cnt++ << ":" << endl; for(q=1; q<=Q; q++) { cin >> x; for(i=1; i<=N; i++) if(a[i] == x) { cout << x << " found at " << i << endl; break; } if(i == N+1) cout << x << " not found" << endl; } } 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
- 转载:Linux环境进程间通信-共享内存
- 三行CSS代码搞定垂直对齐
- 逆转字符串 C语言
- dump函数
- nginx proxy_pass 里的”/”
- UVa-10474-Where is the Marble?
- java 面试分析
- android动态注册广播接收器
- 使用UncaughtExceptionHandler处理未catch到的异常
- adb服务启动失败
- 彩票项目之协议分析,封装
- powershell 关闭系统前挂起vmware workstation 的所有虚机
- 进程,线程,应用程序,任务栈,启动模式
- 动态规划(算法导论第15章)