Advertisement
leminhkt

noname38 (lds)

Apr 5th, 2020
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.21 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define ll long long
  3. #define ld long double
  4. #define lFOR(i, a, b) for(ll i=(a); i<=(b); i++)
  5. #define lFORn(i, n) for(ll i=1; i<=(n); i++)
  6. #define lFORx(i, a, b, n) for(ll i=(a); i<=(b); i+=(x))
  7. #define FORa(i, b) for(i; i<=(b); i++)
  8. #define FORax(i, b, x) for(i; i<=(b); i+=(x))
  9. #define lFORR(i, a, b) for(ll i=(a); i>=(b); i--)
  10. #define lFORRn(i, n) for(ll i=(n); i>=1; i--)
  11. #define lFORRx(i, a, b, n) for(ll i=(a); i>=(b); i-=(x))
  12. #define FORRa(i, b) for(i; i>=(b); i--)
  13. #define FORRax(i, b, x) for(i; i>=(b); i-=(x))
  14. #define iFOR(i, a, b) for(int i=(a); i<=(b); i++)
  15. #define iFORn(i, n) for(int i=1; i<=(n); i++)
  16. #define iFORx(i, a, b, n) for(int i=(a); i<=(b); i+=(x))
  17. #define iFORR(i, a, b) for(int i=(a); i>=(b); i--)
  18. #define iFORRn(i, n) for(int i=(n); i>=1; i--)
  19. #define iFORRx(i, a, b, n) for(int i=(a); i>=(b); i-=(x))
  20. #define pb(x) push_back(x)
  21. #define all(x) (x).begin(), (x).end()
  22. #define sz(x) (x).size()
  23. #define sqr(x) (ll)(x)*(x)
  24. #define PI (2*acos(0))
  25. using namespace std;
  26.  
  27. template <typename T>
  28. inline void Read(T& x)
  29. {
  30.     bool Neg = false;
  31.     char c;
  32.     for (c = getchar(); c < '0' || c > '9'; c = getchar())
  33.         if (c == '-') Neg = !Neg;
  34.     x = c - '0';
  35.     for (c = getchar(); c >= '0' && c <= '9'; c = getchar())
  36.         x = x * 10 + c - '0';
  37.     if (Neg) x = -x;
  38. }
  39. template <typename T>
  40. inline void Write(T x)
  41. {
  42.     if (x < 0)
  43.     {
  44.         putchar('-'); x = -x;
  45.     }
  46.     T p = 1;
  47.     for (T temp = x / 10; temp > 0; temp /= 10) p *= 10;
  48.     for (; p > 0; x %= p, p /= 10) putchar(x / p + '0');
  49. }
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.         //=================declare=================
  57.     int n, res;
  58.     int a[1000005], t[1000005];
  59.  
  60.  
  61.  
  62.  
  63. //=================..end..=================
  64.         //=================function=================
  65.  
  66.  
  67.  
  68.  
  69.  
  70. //=================..end...=================
  71. int main(){
  72.     freopen("LDS.inp", "r", stdin);
  73.     freopen("LDS.out", "w", stdout);
  74.     // ios_base::sync_with_stdio(0); cin.tie(0);
  75.         //=================code=================
  76.     Read(n);
  77.     iFORn(i, n){
  78.         cin>>a[i];
  79.         iFORn(j, i-1) if(a[i]%a[j]==0&&t[i]<t[j]) t[i]=t[j];
  80.         res=max(res, ++t[i]);
  81.     }
  82.     Write(res);
  83.    
  84.  
  85.  
  86.  
  87.  
  88. //=================end.=================
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement