Page 1 of 1

Project 1: Element Pair Number Problem (求解满足条件的元素对个数问题) 1: Introduction Problem description and (if any) background of t

Posted: Mon May 09, 2022 5:59 am
by answerhappygod
 1
1 (48.72 KiB) Viewed 35 times
 2
2 (42.79 KiB) Viewed 35 times
Project 1: Element Pair Number Problem (求解满足条件的元素对个数问题) 1: Introduction Problem description and (if any) background of the algorithms. Description: Given N integers Ai and a positive integer C, how many pairs of i and j satisfying Ai- Aj=C? (给定N个整数Ai以及一个正整数C,问 38 Ai-Aj=C. ) Input: In the first line, enter the integers N and C separated by two spaces. Lines 2-N+1 contain an integer Ai in each line. (第一行输入两个空格隔开的整数N和 C,第2~N+1行每行包含一个整数Ai。) Output: A number to represent the answer (输出一个数表示答案。 Sample Input 53 2 1 4 2 5 Sample Output 3
2: Algorithm Specification Description (pseudo-code preferred) of all the algorithms involved for solving the problem, including specifications of main data structures. 3: Testing Results Table of test cases. Each test case usually consists of a brief description of the purpose of this case, the expected result, the actual behavior of your program, the possible cause of a bug if your program does not function as expected, and the current status ("pass", or "corrected", or "pending") 4: Analysis and Comments Analysis of the time and space complexities of the algorithms. Comments on further possible improvements. Appendix: Source Code (in C/C++) At least 30% of the lines must be commented. Otherwise the code will NOT be evaluated.