SHARE
TWEET

Untitled

a guest Jul 18th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int main()
  2. {
  3.   int i, j, x;
  4.   fin >> n;
  5.   for(i = 1; i <= n; ++i)
  6.     {
  7.       fin >> x;
  8.       f[x]++;
  9.     }
  10.   if(f[1] == n)
  11.     {
  12.       fout << 1;
  13.       return 0;
  14.     }
  15.   if(f[2] == n)
  16.     {
  17.       fout << 2;
  18.       return 0;
  19.     }
  20.   for(i = 1000; i >= 1; --i)
  21.     f[i] += f[i + 1];
  22.   for(i = 3; i <= n; ++i)
  23.     if(f[i] >= i)
  24.       {
  25.         fout << i;
  26.         return 0;
  27.       }
  28.   return 0;
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top