Advertisement
semsem_elazazy

Untitled

Apr 25th, 2022
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. #include<utility>
  4. #include <queue>
  5. #define ll long long
  6. #define ull unsigned long long
  7. #define pi  3.14159
  8.  
  9. #define OO  2000000000
  10. //#define ceil(w, m) (((w) / (m)) + ((w) % (m) ? 1 : 0))
  11. using namespace std;
  12.  
  13. void yasmeen_fakhri(){
  14.   ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  15.   #ifndef ONLINE_JUDGE  
  16.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  17.   #endif
  18. }
  19.  
  20.  
  21.  
  22. int main() {
  23.    yasmeen_fakhri();
  24.  
  25.   int n , k ;   cin>>n>>k;
  26.   int arr[n]; int freq[1005]={0};
  27.   for(int i=1 ; i<=n; i++){
  28.       cin>>arr[i];
  29.       freq[arr[i]]++;
  30.      
  31.   }
  32.   int arr1[1005]={0};
  33.   int c =1;
  34.   for(int i=1 ; i<=1005 ; i++){
  35.       int m=i ;
  36.       if(freq[m] == 0)  {
  37.       arr1[c] = m ;
  38.       c++;
  39.   }
  40.   }
  41.   cout<<arr1[k];
  42.  
  43.    return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement