statistical-problem

所属分类:数据结构
开发工具:Visual C++
文件大小:9KB
下载次数:4
上传日期:2011-08-26 09:47:23
上 传 者zrhkwz
说明:  Description: 计算机似乎生来就是干苦力的,不是吗?统计就是这种苦力中的一种,而如果你运气不好,刚好碰到有很多重复数据的时候,就更加令人感到乏味。那么,你的任务来了。现在,给你一列数 A1, A2, … An 。然后要你回答,对于给定的区间,里面到底有多少个不重复的数。 Input: 一个整数 T (T <= 10) ,表示有 T 组测试数据。 每组数据第一行是数 N (1 <= N <= 30000) 。 第二行有 N 个数 A1 A2 … An (0 <= Ai <= 2^31 - 1) 。 第三行是数 Q (1 <= Q <= 100000) 。 接下来 Q 行是 Q 个询问 X Y (1 <= x <= y <= N) 。 Output: 对于每个询问,输出一个答案,一个答案占一行。 Sample Input: 2 3 1 1 4 2 1 2 2 3 5 1 1 2 1 3 3 1 5 2 4 3 5 Sample Output: 1 2 3 2 3 Source: ycc
(Think: The computer, which seems to do the coolie was born, isn t it? Statistics is one of the the workhorses, and if you are unlucky, just come up against many repeating data, more people feel boring. So, your task. Now, give you a list of several A1, A2,... An. Then will you answer, for a given interval, exactly how many don t repeat number. Input: An integer T (T < = 10), said a T test data. Each group of data is the first line number N (1 < = N < = 30000). The second line have N number A1 A2... An (0 < = Ai < = 2 ^ 31-1).The third line is a number (1 Q < = Q < = 100000). The next line is a Q Q ask X Y (1 < = X < = Y < = N). Output: For each inquiry, the output one answer, an answer of a line. Sample Input: 2 3 1 1 4 2 1 2 2 3 5 1 1 2 1 3 3 1 of 5 2 4 3 5 Sample Output: 1 2 3 2 3 Returned: ycc )

文件列表:
statistical problem.docx (11508, 2011-08-26)

近期下载者

相关文件


收藏者