artemgf

Отличная команда

Apr 21st, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <string>
  4. #include <algorithm>
  5. #include <vector>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     long long good, sc=0, maxsc=0, n, promcor, num=1, answer;
  12.  
  13.     cin >> n;
  14.  
  15.     cin >> good;
  16.     for (int a = 2; a <= n; a++)
  17.     {
  18.         cin >> promcor;
  19.         if (promcor < good)
  20.         {
  21.             sc++;
  22.             good = promcor;
  23.             if (maxsc <= sc)
  24.             {
  25.                 maxsc = sc;
  26.                 answer = num;
  27.             }
  28.             sc = 0;
  29.             num = a;
  30.         }
  31.         else
  32.             sc++;
  33.     }
  34.    
  35.     if (maxsc <= sc)
  36.     {
  37.         maxsc = sc;
  38.         answer = num;
  39.     }
  40.    
  41.  
  42.     cout << answer;
  43.     _getch();
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment