1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib> 9 #include<algorithm> 10 #include<set> 11 #include<list> 12 #include<iomanip> 13 #include<cstring> 14 #include<cmath> 15 #include<limits> 16 using namespace std; 17 18 #define au auto 19 #define debug(i) cout<<"<debug> "<<i<<"<\debug>"<<endl 20 #define mfor(i,a,b) for(register int i=(a);i<=(b);i++) 21 #define mrep(i,a,b) for(register int i=(a);i>=(b);i--) 22 #define LLL __int128 23 #define Re register 24 #define il inline 25 #define mem(a,b) memset(a,(b),sizeof(a)) 26 typedef pair<int, int> intpair; 27 typedef long long int LL; 28 const int INF = 0x3f3f3f3f; 29 const long long int INFLL = 0x3f3f3f3f3f3f3f3f; 30 31 int T; 32 int n; 33 int st[1010]; 34 35 int main() 36 { 37 cin >> T; 38 mfor(i, 1, T) 39 { 40 int n; 41 cin >> n; 42 mfor(i, 1, n) cin >> st[i]; 43 sort(st + 1, st + 1 + n); 44 bool f = true; 45 mfor(i, 2, n) 46 { 47 if (st[i - 1] + 1 == st[i]) 48 { 49 cout << 2 << endl; 50 f = false; 51 break; 52 } 53 } 54 if(f) cout << 1 << endl; 55 } 56 }View Code