标签:io ar for sp c amp c++ r res
//用map来实现总是超出最大的内存限制
题目描述:
统计一个数字在排序数组中出现的次数。#include<cstdio> using namespace std; int main() { int count1; while(scanf("%d",&count1)!=EOF) { short array[1000001]={0}; int num; for(int i=0;i<count1;i++) { scanf("%d",&num); ++array[num]; } int count2; scanf("%d",&count2); for(int i=0;i<count2;i++) { scanf("%d",&num); printf("%d\n",array[num]); } } return 0; } /************************************************************** Problem: 1349 User: hndxztf Language: C++ Result: Accepted Time:790 ms Memory:2904 kb ****************************************************************/
标签:io ar for sp c amp c++ r res
原文地址:http://blog.csdn.net/mnmlist/article/details/39267813