UVa 10474 - Where is the Marble?
来源:互联网 发布:河北网络公益广告大赛 编辑:程序博客网 时间:2024/04/30 17:15
#include <iostream>#include <cstdio>#include <cstring>int a[10010];using namespace std;int main(){ #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); #endif int n, q; int num; int test_case = 0; while(scanf("%d%d", &n, &q) == 2) { if(n==0 && q==0) break; memset(a, 0, sizeof(a)); while(n--) { scanf("%d", &num); a[num]++; } int pre=1, temp; for(int i=1; i<=10000; i++) { if(a[i] > 0) { temp = pre + a[i]; a[i] = pre; pre = temp; } } printf("CASE# %d:\n", ++test_case); while(q--) { scanf("%d", &num); if(a[num] <= 0) printf("%d not found\n", num); else printf("%d found at %d\n", num, a[num]); } } return 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
- poj_2387(最短路径Dijkstra)
- Android学习笔记
- 程序员
- 杭电2015
- 中国雅虎殒身记:当初说好的独立上市呢?
- UVa 10474 - Where is the Marble?
- vc mfc实现dialog半透明置顶效果
- mono中的中文问题
- 黑马程序员---线程
- 杭电2016
- iOS 对iphone和 ipad的摄像头和图片库的区别处理代码
- 【VS_2012】关于缺少MSVCP100D.dll的错误
- & 和 &&、|和||的区别:
- HDU 1068最大独立集 = n - 最大匹配