Cod sursa(job #1010728)

Utilizator leontinLeontin leontin Data 15 octombrie 2013 16:56:27
Problema Subsir crescator maximal Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.44 kb
#include<iostream>
#include<fstream>
 using namespace std;
 int main()
 {int n,v[100],i,w[100],max=0,y,x,j;
 ifstream f("scmax.in");
 ofstream g("scmax.out");
 f>>n>>x;
 y=1;
 v[1]=x;
 for(i=2;i<=n;i++)
 {f>>x;
 if(x>v[y])
 {y++;
 v[y]=x;}
 else
	 if(x<v[y])
 {y=1;
 v[y]=x;
 }
 if(max<y)
 {max=y;
 for(j=1;j<=max;j++)
	 w[j]=v[j];
 }
 }
 for(i=1;i<=max;i++)
	 g<<w[i]<<" ";
 
g<<"\n"<<max;
 f.close();
 g.close();
 }