Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8.  
  9. {
  10.  
  11.    int n, a, k, len, b, i;
  12.  
  13.    ifstream f("platou2.in");
  14.  
  15.    ofstream g("platou2.out");
  16.  
  17.    f >> n >> a;
  18.  
  19.    len=1; k=1; b=a;
  20.  
  21.    for (i=2; i<=n; ++i)
  22.  
  23.    {
  24.  
  25.        f >> a;
  26.  
  27.        if (a>b) ++len;
  28.  
  29.        else
  30.  
  31.        { if (len>k) k=len;
  32.  
  33.            len=1;
  34.  
  35.        }
  36.  
  37.        b=a;
  38.  
  39.    }
  40.  
  41.    if (len>k) k=len;
  42.  
  43.    g << k;
  44.  
  45.  return 0;
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement