fork download
  1. /*
  2. *************************************************************************
  3. * $ Author : honeyslawyer $
  4. * $ Name : shashank gupta $
  5. *************************************************************************
  6. *
  7. * Copyright 2013 @ honeyslawyer and shashank gupta
  8. *
  9. ************************************************************************/
  10. #include<cstdio>
  11. #include<iostream>
  12. #include<cmath>
  13. //#include<conio.h>
  14. #include<cstring>
  15. #include<ctype.h>
  16. #include<algorithm>
  17. #include<vector>
  18. #include<stdlib.h>
  19. #include<map>
  20. #include<queue>
  21. #include<stack>
  22. #include<set>
  23. #include<string>
  24. #include<climits>
  25.  
  26. #define mod 1000000007
  27. #define ll long long
  28.  
  29. using namespace std;
  30. ll gcd(ll a,ll b) {if(b==0) return a; return gcd(b,a%b);}
  31.  
  32. ll power(ll b,ll exp,ll m)
  33. {ll ans=1;
  34. b%=m;
  35. while(exp)
  36. {if(exp&1)
  37. ans=(ans*b)%m;
  38. exp>>=1;
  39. b=(b*b)%m;
  40. }
  41. return ans;
  42. }
  43. int b[200],arr[200];
  44. int main()
  45. {
  46. int n;
  47. scanf("%d",&n);
  48. for(int i=0;i<n;i++)
  49. {
  50. scanf("%d",&b[i]);
  51. arr[b[i]]++;
  52. }
  53. int ans=0;
  54. for(int i=0;i<=100;i++)
  55. {
  56. int size=0;
  57. if(arr[i]>0)
  58. {
  59. ans++;
  60. arr[i]--;
  61. size++;
  62. for(int j=size;j<=100;j++)
  63. {
  64. if(arr[j]>0)
  65. {
  66. //printf("%d\n",j);
  67. arr[j]--;
  68. size++;
  69. j=size-1;
  70. }
  71. }
  72. }
  73. if(arr[i]>0)
  74. i--;
  75. }
  76. printf("%d\n",ans);
  77.  
  78. //getch();
  79. return 0;
  80. /*checklist
  81. 1)getch() and conio.h removed.*/
  82. }
  83.  
Success #stdin #stdout 0s 3300KB
stdin
9
0 0 0 1 1 1 2 2 10
stdout
3