fork(1) download
  1. #include <bits/stdc++.h>
  2.  
  3. // limit
  4. #define mod1 22439423LL
  5. #define mod2 42342432LL
  6. #define mod3 56454765LL
  7. #define mod4 66867574LL
  8. #define oo 1000000007
  9. #define OO 1000000000000000007LL
  10.  
  11. // loop
  12. #define fto(i, x, y) for(int i = (x); i <= (y); ++i)
  13. #define fdto(i, x, y) for(int i = (x); i >= (y); --i)
  14. #define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
  15. #define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
  16. #define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
  17. #define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
  18. #define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)
  19.  
  20. // debug
  21. #define debug cout << "*" << endl;
  22. #define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
  23. #define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
  24. #define bug(a) cout << #a << " = " << a << endl;
  25. #define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
  26. #define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;
  27.  
  28. // operation
  29. #define mp make_pair
  30. #define pb push_back
  31. #define pf push_front
  32. // structure
  33. #define ii pair<int, int>
  34. #define iii pair<ii, int>
  35. #define vi vector<int>
  36. #define vll vector<ll>
  37. #define vii vector<ii>
  38. #define matrix vector<vi>
  39.  
  40. // get value
  41. #define FF first
  42. #define SS second
  43.  
  44. // data type
  45. #define ll long long
  46. #define ull unsigned long long
  47.  
  48. // function
  49. #define lb lower_bound
  50. #define ub upper_bound
  51.  
  52. // const value
  53. #define pi 3.14159265358979323846264338327950288419716939937510
  54.  
  55. using namespace std;
  56.  
  57. template <class T>
  58. T min(T a, T b, T c) {
  59. return min(a, min(b, c));
  60. }
  61.  
  62. template <class T>
  63. T min(T a, T b, T c, T d) {
  64. return min(a, min(b, min(c, d)));
  65. }
  66.  
  67. template <class T>
  68. T max(T a, T b, T c) {
  69. return max(a, max(b, c));
  70. }
  71.  
  72. template <class T>
  73. T max(T a, T b, T c, T d) {
  74. return max(a, max(b, max(c, d)));
  75. }
  76.  
  77. bool cmp(const ii& a, const ii& b) {return (a.FF > b.FF || (a.FF == b.FF && a.SS >= b.SS));}
  78. ll GCD(ll a, ll b) {return (a%b) ? GCD(b, a%b) : b;}
  79.  
  80. const string namePro = "tmp";
  81. #define maxN 100007
  82.  
  83. int main() {
  84. #ifndef ONLINE_JUDGE
  85. // freopen((namePro+".inp").c_str(), "r", stdin);
  86. // freopen((namePro+".out").c_str(), "w", stdout);
  87. #endif // ONLINE_JUDGE
  88.  
  89. int n;
  90. double eps = 1e-9;
  91.  
  92. while (scanf("%d", &n) == 1) {
  93. int ans = 0;
  94. double cur = -oo;
  95. fto (i, 1, n) {
  96. double x;
  97. scanf("%lf", &x);
  98. if (x-cur > 1.0-eps) {
  99. ++ans;
  100. cur = x;
  101. }
  102. }
  103. printf("%d\n", ans);
  104. }
  105. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty