Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 1st, 2020 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin >> n;
  9.  
  10.     int start = 0, stop = 0;
  11.     int lungimeMaxima = 0, lungimeSecventaInCurs = 1;
  12.     int x, y;
  13.  
  14.     cin >> x;
  15.     for (int i = 2; i <= n; ++i)
  16.     {
  17.         cin >> y;
  18.         if (x == y)
  19.             ++lungimeSecventaInCurs;
  20.         else
  21.             lungimeSecventaInCurs = 1;
  22.  
  23.         if (lungimeSecventaInCurs >= lungimeMaxima)
  24.         {
  25.             lungimeMaxima = lungimeSecventaInCurs;
  26.             start = i - lungimeSecventaInCurs + 1;
  27.             stop = i;
  28.         }
  29.         x = y;
  30.     }
  31.  
  32.     cout << start << ' ' << stop;
  33.     return 0;
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top