NYOJ595 乱七八糟
来源:互联网 发布:win10怎么查mac地址 编辑:程序博客网 时间:2024/04/29 18:54
原题链接
#include <stdio.h>#include <stdlib.h>#include <string.h>int a[100], b[101];int cmp(const void *a, const void *b){return *(int *)b - *(int *)a;}int main(){int n, m, i, count, t, j;while(scanf("%d%d", &n, &m) == 2){if(n == 0 || m == 0) continue;for(i = 0; i != n; ++i)scanf("%d", &a[i]);qsort(a, n, sizeof(int), cmp);for(i = 0, count = 0; i != n; ++i, count = 0){for(j = i; j != n; ++j)if(a[i] == a[j])++count;else break;b[i + 1] = count;i = j - 1;}while(m-- && scanf("%d", &t))printf("%d\n", b[t]);memset(b, 0, sizeof(b));}return 0;}
0 0
- NYOJ595 乱七八糟
- NYOJ595乱七八糟好坑的水题~~
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- android 开发中修改sdk level
- 创建MATLAB adaptor的项目
- linux下用socket传送xml格式的文件方法
- eclipse的一些开发技巧
- sdjzu 21273
- NYOJ595 乱七八糟
- Solved Unable to copy the source file ./installer/services.sh to the destination file /etc/vmware-t
- java注释
- 电脑初学者怎样清理C盘
- 图像缩放算法
- 如何在iOS中使用ZXing库
- iOS系统Crash文件分析方法
- poj1611
- PB中实现dropdownlistbox和数据库绑定