Description
T. chur teaches various groups of students at university U. every U-student has a unique student identification number (SIN ). A sin s is an integer in the range 0 ≤ S ≤ maxsin with maxsin = 106-1. t. chur finds this range of sins too large for identification within her groups. for each group, she wants to find the smallest positive integer m, such that within the group all sins CED modulo m are unique.
Input
On the first line of the input is a single positive integer N, telling the number of test cases (groups) to follow. each case starts with one line containing the integer g (1 ≤ G ≤300): the number of students in the group. the following G lines each contain one sin. the Sins within a group are distinct, though not necessarily sorted.
Output
For each test case, output one line containing the smallest Modulus m, such that all sins reduced modulo m are distinct.
Sample Input
211248663124866111111987651
Sample output
18. modulo the same number of M values for the given groups of data. The remainder is different .....# Include <iostream> # include <cstdio> # include <cstring> # include <algorithm> using namespace STD; const int maxn = 1000000 + 5; int A [305]; int B [maxn]; int main () {int N, I; CIN> N; while (n --) {int t; CIN> T; for (I = 0; I <t; I ++) scanf ("% d", & A [I]); If (t = 1) printf ("1 \ n"); else {for (I = 2; I ++) {bool flag = 0; memset (B, 0, sizeof (INT) * (I + 1); // key use; otherwise, TLE will die... For (Int J = 0; j <t; j ++) {B [A [J] % I] ++; if (B [A [J] % I] = 2) {flag = 1; break ;}} if (flag = 0) break ;} cout <I <Endl ;}} return 0 ;}
Reduced ID numbers (Key use of memset)