Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int x, i, j, maxi=0;
- cin >> x;
- int niza[x], vrednost[x];
- vrednost[x] = {0};
- for(i=0; i<x; i++) cin >> niza[i];
- vrednost[0] = 1;
- for(i=1; i<x; i++)
- {
- maxi = 0;
- for(j=i-1; j>=0; j--)
- {
- if(niza[i]>niza[j] and vrednost[j]>maxi) maxi = vrednost[j];
- }
- vrednost[i] = maxi + 1;
- }
- maxi = 0;
- for(i=0; i<x; i++)
- {
- if(vrednost[i]>maxi)maxi = vrednost[i];
- }
- cout << maxi;
- //cout << vrednost[i] << " ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment