Cod sursa(job #187554)

Utilizator tiger_snowIacob Andrei Bogdan tiger_snow Data 4 mai 2008 17:36:02
Problema Secventa Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include<fstream.h>
int main()
{
	int n,k,x[1000],i,max=0,ii,j;
   ifstream in("secventa.in");
   in>>n>>k;
   for(i=1;i<=n;i++){in>>x[i];}
   in.close();
   max=x[1];
   for(j=1;j<=n-k;j++)
   {
	 	if (x[j]>max)
      {
      	ii=j;
      	max=x[j];
      }
   }
	ofstream out("secventa.out");
   out<<ii<<" "<<(ii+k)<<" "<<max;
   out.close();
   return 0;
}