Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- int main(){
- int n, v[100], ct=1, max=1, l=1, i;
- ifstream f("crescator2.in");
- ofstream g("crescator2.out");
- f>>n;
- for(i=0;i<n;i++)
- f>>v[i];
- for(i=1;i<n;i++){
- if(v[i]>=v[i-1]){
- ct++;
- l++;
- }
- else{
- l=1;
- ct=ct*(ct+1)/2;
- }
- if(l>max)
- max=l;
- }
- ct=ct+n;
- g<<ct<<" "<<max;
- }
Add Comment
Please, Sign In to add comment