Advertisement
askarulytarlan

zadacha 3

Dec 9th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int n;
  6. int k[1000000];
  7. int cnt = 0, d, cnt2 = 1;
  8.  
  9. int main() {
  10. cin >> n;
  11. for(int i = 0; i < n; i++){
  12. cin >> k[i];
  13. }
  14. for(int i = 0; i < n - 1; i++){
  15. for(int j = i + 1; j < n; j++){
  16. if(k[i] < k[j]){
  17. cnt2++;
  18. }
  19. }
  20. if(cnt2 > cnt){
  21. cnt = cnt2;
  22. }
  23. cnt2 = 1;
  24. }
  25. cout << cnt;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement