fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main() {
  6. // your code goes here
  7.  
  8.  
  9.  
  10.  
  11.  
  12. int t,n;
  13. float f;
  14. cin>>t;
  15. while(t--)
  16. {
  17. int hash[]={0,0,0,0,0,0};
  18. int r=2,count=0;
  19. cin>>n;
  20. //int flag=0;
  21. for(int i=1;i<=n;i++)
  22. {
  23. cin>>f;
  24. int o=f;
  25. //cout<<o<<endl;
  26. o=o/80;
  27. //cout<<o<<endl;
  28. //cout<<o<<endl;
  29. if(hash[o]==0)
  30. {
  31. r=2;
  32. hash[o]=1;
  33. /*
  34. for(int i=o-1;i>=0;i--)
  35. {
  36. if(hash[i]==0)
  37. {
  38. r+=2;
  39. hash[i]=1;
  40. }
  41. else break;
  42. }
  43. */
  44. //cout<<r<<endl;
  45. // hash[o]=1;
  46. if(r>0)
  47. {
  48. r--;
  49. count++;
  50. //cout<<r<<" "<<count<<endl;
  51. }
  52. }
  53. else
  54. {
  55. if(r>0)
  56. {
  57. r--;
  58. count++;
  59. }
  60. }
  61.  
  62.  
  63.  
  64.  
  65. }
  66.  
  67. cout<<count<<endl;
  68. }
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78. return 0;
  79. }
Success #stdin #stdout 0s 16064KB
stdin
1
15
10.5
19.6
62.4
167
223
224
236
239
432
433
434
435
436
437
439
stdout
6