Advertisement
a53

radiera

a53
Dec 27th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <fstream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. short constructL(short a[],short n)
  6. {
  7. int L[n];
  8. L[0]=1;
  9. for(int i=1;i<n;++i)
  10. {
  11. L[i]=1;
  12. for (int j=0;j<i;++j)
  13. if( a[i]>=a[j]&&L[i]<L[j]+1)
  14. L[i]=L[j]+1;
  15. }
  16. return *max_element(L,L+n);
  17.  
  18. }
  19.  
  20. int main()
  21. {
  22. short n,v[1001];
  23. ifstream f("radiera.in");
  24. f>>n;
  25. for(short i=0;i<=n;++i)
  26. f>>v[i];
  27. f.close();
  28. short m=constructL(v,n);
  29. ofstream g("radiera.out");
  30. g<<(n-m);
  31. g.close();
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement