Promi_38

cf 1466B

Oct 1st, 2021 (edited)
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int t;
  8.     scanf("%d", &t);
  9.     while(t--)
  10.     {
  11.         int n;
  12.         scanf("%d", &n);
  13.  
  14.         int a[n], i;
  15.         set<int>S;
  16.        
  17.         for(i = 0; i < n; i++) scanf("%d", &a[i]);
  18.         //sort(a, a+n);
  19.         for(i = 0; i < n; i++)
  20.         {
  21.             if(S.count(a[i])) a[i]++;
  22.             S.insert(a[i]);
  23.         }
  24.         printf("%d\n", S.size());
  25.     }
  26. }
  27.  
Add Comment
Please, Sign In to add comment