codeforces div3 19/10/23A.Yet Another Dividing into Teams

Posted thjkhdf12

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了codeforces div3 19/10/23A.Yet Another Dividing into Teams相关的知识,希望对你有一定的参考价值。

技术图片
 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

 

以上是关于codeforces div3 19/10/23A.Yet Another Dividing into Teams的主要内容,如果未能解决你的问题,请参考以下文章

Codeforces Round #605(Div3)A~E

codeforces #587 div3 ABCDE

Codeforces Round #617(div3) A-E2题解

Codeforces Round #617(div3) A-E2题解

codeforces #634(div3) A-E题解

Codeforces Round 615 div3 Solution